[PATCH] D22334: Fix for Bug 28172 : clang crashes on invalid code (with too few arguments to __builtin_signbit) without any proper diagnostics.
Mayur Pandey via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 13 21:26:37 PDT 2016
mayurpandey created this revision.
mayurpandey added reviewers: george.burgess.iv, hfinkel.
mayurpandey added a subscriber: cfe-commits.
clang was crashing when no argument was provided to __builtin_signbit function. Added a check to handle the error. No regressions on testing.
http://reviews.llvm.org/D22334
Files:
lib/Sema/SemaChecking.cpp
test/Sema/builtins.c
Index: test/Sema/builtins.c
===================================================================
--- test/Sema/builtins.c
+++ test/Sema/builtins.c
@@ -248,3 +248,7 @@
return buf;
}
+
+int test21(double a) {
+ return __builtin_signbit(); // expected-error {{too few arguments}}
+}
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -763,6 +763,10 @@
}
break;
}
+ case Builtin::BI__builtin_signbit:
+ if (checkArgCount(*this, TheCall, 1))
+ return true;
+ break;
case Builtin::BI__builtin_isgreater:
case Builtin::BI__builtin_isgreaterequal:
case Builtin::BI__builtin_isless:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22334.63913.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160714/f940ecf0/attachment.bin>
More information about the cfe-commits
mailing list