summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/builtin-object-size.c
Commit message (Collapse)AuthorAgeFilesLines
* [x86] Teach the builtin argument range check to allow invalid ranges inChandler Carruth2018-06-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dead code. This is important for C++ templates that essentially compute the valid input in a way that is constant and will cause all the invalid cases to be dead code that is deleted. Code in the wild actually does this and GCC also accepts these kinds of patterns so it is important to support it. To make this work, we provide a non-error path to diagnose these issues, and use a default-error warning instead. This keeps the relatively strict handling but prevents nastiness like SFINAE on these errors. It also allows us to safely use the system to diagnose this only when it occurs at runtime (in emitted code). Entertainingly, this required fixing the syntax in various other ways for the x86 test because we never bothered to diagnose that the returns were invalid. Since debugging these compile failures was super confusing, I've also improved the diagnostic to actually say what the value was. Most of the checks I've made ignore this to simplify maintenance, but I've checked it in a few places to make sure the diagnsotic is working. Depends on D48462. Without that, we might actually crash some part of the compiler after bypassing the error here. Thanks to Richard, Ben Kramer, and especially Craig Topper for all the help here. Differential Revision: https://reviews.llvm.org/D48464 llvm-svn: 335309
* Fix an assertion failure regression in isDesignatorAtObjectEnd forAlex Lorenz2017-12-201-0/+19
| | | | | | | | | | | | | | __builtin_object_size with incomplete array type in struct The commit r316245 introduced a regression that causes an assertion failure when Clang tries to cast an IncompleteArrayType to a PointerType when evaluating __builtin_object_size. rdar://36094951 Differential Revision: https://reviews.llvm.org/D41405 llvm-svn: 321222
* Don't let EvaluationModes dictate whether an invalid base is OKGeorge Burgess IV2017-02-101-0/+15
| | | | | | | | | | | | What we want to actually control this behavior is something more local than an EvalutationMode. Please see the linked revision for more discussion on why/etc. This fixes PR31843. Differential Revision: https://reviews.llvm.org/D29469 llvm-svn: 294800
* [ExprConstant] Fix PR28314 - crash while evluating objectsize.George Burgess IV2016-06-271-0/+24
| | | | | | | | | | | | | | | | | | | | | This fixes a crash in code like: ``` struct A { struct B b; char c[1]; } int foo(struct A* a) { return __builtin_object_size(a->c, 0); } ``` We wouldn't check whether the structs we were examining were invalid, and getting the layout of an invalid struct is (unsurprisingly) A Bad Thing. With this patch, we'll always return conservatively if we see an invalid struct, since I'm assuming the presence of an invalid struct means that our compilation failed (so having a conservative result isn't such a big deal). llvm-svn: 273911
* Fix the argument index error of __builtin___memccpy_chkSteven Wu2014-09-241-0/+9
| | | | | | | memccpy_check should have source and dest size at arg 3 and 4 rdar://18431336 llvm-svn: 218367
* Attempt to fix Sema/builtin-object-size.c after r218258Hans Wennborg2014-09-231-1/+1
| | | | | | The type of size_t varies between targets. llvm-svn: 218288
* Fix evatuated value of __builtin_object_size according to itsFariborz Jahanian2014-09-221-0/+17
| | | | | | | 'type' argument when it cannot be determined which objects ptr points to at compile time. rdar://18334276 llvm-svn: 218258
* Patch to check at compile time for overflow whenFariborz Jahanian2014-09-181-1/+1
| | | | | | | | __builtin___memcpy_chk and similar builtins are being used. Patch by Jacques Fortier (with added clang tests). rdar://11076881 llvm-svn: 218063
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-2/+2
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-1/+1
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-2/+2
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Append the test runs with '&&'.Argyrios Kyrtzidis2008-10-051-1/+1
| | | | llvm-svn: 57085
* Fix rdar://6252231 - cannot call vsnprintf with va_list on x86_64,Chris Lattner2008-09-281-0/+9
| | | | | | | | by decaying __builtin_va_list's type when forming builtins. On x86-64 (and other targets) __builtin_va_list is a typedef for an array. llvm-svn: 56768
* Add two test cases for builtins (mostly related to object sizeDaniel Dunbar2008-09-031-0/+19
builtins). llvm-svn: 55736
OpenPOWER on IntegriCloud