This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Prevent crash while trying to merge types
ClosedPublic

Authored by davide on Apr 23 2015, 3:46 PM.

Details

Summary

This fixes bug 23086.
__builtin_isnan(...) causes clang to crash in sema. The proposed patch is an attempt to fix.

Diff Detail

Repository
rL LLVM

Event Timeline

davide updated this revision to Diff 24336.Apr 23 2015, 3:46 PM
davide retitled this revision from to [Sema] Prevent crash while trying to merge types.
davide updated this object.
davide edited the test plan for this revision. (Show Details)
davide added reviewers: rsmith, aaron.ballman.
davide set the repository for this revision to rL LLVM.
davide added a subscriber: Unknown Object (MLST).
rsmith added inline comments.Apr 23 2015, 4:07 PM
lib/Sema/SemaDecl.cpp
2988–2991 ↗(On Diff #24336)
  • This function should not return true without a diagnostic having been emitted.
  • NewProto cannot be null here due to the check on line 2979.
  • OldProto should not be null here due to the check on line 2978.

Perhaps the root cause of the problem is that we set the wrong value for hasPrototype up on line 1752? We should be checking whether the builtin type is in fact a FunctionProtoType rather than just assuming it is.

davide updated this revision to Diff 24347.Apr 23 2015, 6:41 PM
davide removed rL LLVM as the repository for this revision.

Yes, thanks. That actually worked and passes the test suite.
Does the check look fine to you?

rsmith accepted this revision.Apr 24 2015, 8:30 AM
rsmith edited edge metadata.

Yes, this seems like a reasonable approach (please also include the testcase from your previous patch).

This revision is now accepted and ready to land.Apr 24 2015, 8:30 AM
This revision was automatically updated to reflect the committed changes.