summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/vla.c
Commit message (Collapse)AuthorAgeFilesLines
* Detect an incompatible VLA pointer assignmentJeremy Morse2018-06-051-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | For pointer assignments of VLA types, Clang currently detects when array dimensions _lower_ than a variable dimension differ, and reports a warning. However it does not do the same when the _higher_ dimensions differ, a case that GCC does catch. These two pointer types int (*foo)[1][bar][3]; int (*baz)[1][2][3]; are compatible with each another, and the program is well formed if bar == 2, a matter that is the programmers problem. However the following: int (*qux)[2][2][3]; would not be compatible with either, because the upper dimension differs in size. Clang reports baz is incompatible with qux, but not that foo is incompatible with qux because it doesn't check those higher dimensions. Fix this by comparing array sizes on higher dimensions: if both are constants but unequal then report incompatibility; if either dimension is variable then we can't know either way. Differential Revision: https://reviews.llvm.org/D47628 llvm-svn: 333989
* Add another test for PR36157.Richard Smith2018-02-241-0/+8
| | | | llvm-svn: 325998
* [Sema] Correctly recurse when looking for [*] in function definitionsDavid Majnemer2015-04-071-0/+3
| | | | | | | | | | A [*] is only allowed in a declaration for a function, not in its definition. We didn't correctly recurse while looking for it, causing us to crash in CodeGen instead of rejecting it. This fixes PR23151. llvm-svn: 234363
* Replace "can not" with "cannot" in diagnostics messages.Ismail Pazarbasi2014-03-071-4/+4
| | | | llvm-svn: 203302
* Fix a minor regression from my potentially-evaluated expression changes.Eli Friedman2012-02-061-0/+5
| | | | llvm-svn: 149930
* when compiling in a GNU mode (e.g. gnu99) treat VLAs with a size that can be ↵Chris Lattner2011-06-141-2/+2
| | | | | | | | | | folded to a constant as constant size arrays. This has slightly different semantics in some insane cases, but allows us to accept some constructs that GCC does. Continue to be pedantic in -std=c99 and other modes. This addressed rdar://8733881 - error "variable-sized object may not be initialized"; g++ accepts same code llvm-svn: 132983
* Fix for PR5185. C99 [*] VLA notation should be disallowed in function ↵Sam Weinig2010-02-011-0/+6
| | | | | | definitions. llvm-svn: 94972
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - 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
* Revert r72575, which isn't really right, and fix up other code to Eli Friedman2009-05-291-1/+1
| | | | | | handle the construct in question correctly. llvm-svn: 72581
* Avoid dumping during semantic analysis when checking array types whenMike Stump2009-05-291-0/+3
| | | | | | a vla is used. llvm-svn: 72575
* PR2044: reject declarations of functions returning variably modified Eli Friedman2009-05-161-0/+5
| | | | | | types. llvm-svn: 71941
* Add a bit more handling for declarations like "int a[*]".Eli Friedman2009-04-261-0/+3
| | | | llvm-svn: 70162
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix for PR3663/3669: use TryToFixInvalidVariablyModifiedType for Eli Friedman2009-02-261-1/+3
| | | | | | | variable declarations where applicable. Also, a few fixes to TryToFixInvalidVariablyModifiedType for issues that this exposed. llvm-svn: 65500
* Extend the implicit declaration and checking against out-of-scopeDouglas Gregor2009-02-241-3/+3
| | | | | | | | | | | | | external declarations to also support external variable declarations. Unified the code for these two cases into two new subroutines. Note that we fail to diagnose cases like the one Neil pointed out, where a visible non-external declaration hides an external declaration by the same name. That will require some reshuffling of name lookup. llvm-svn: 65385
* a minor grammar fixChris Lattner2008-12-071-3/+3
| | | | llvm-svn: 60646
* Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.Anders Carlsson2008-12-071-0/+25
| | | | llvm-svn: 60638
* Rewrite FindDiagnostics to be more strict about the formatting of the Chris Lattner2008-11-241-1/+1
| | | | | | | expected-foo strings. Now the only allowed characters between expected-error and {{ is whitespace. llvm-svn: 59925
* clean up -verify mode output. If the expected-error string is Chris Lattner2008-11-231-1/+1
| | | | | | mangled, report it using the diagnostics machinery instead of printf. llvm-svn: 59924
* Fix a FIXME by improving a diagnostic, add a testcase for PR3048Chris Lattner2008-11-121-0/+3
| | | | llvm-svn: 59167
* wrap some long diagnostics, make 'initializer is not a constant' diagnosticChris Lattner2008-08-101-1/+1
| | | | | | a bit more clear (rdar://5646070) llvm-svn: 54606
* Fix this test so that it's valid; the point is to test for the crash, Eli Friedman2008-05-211-1/+1
| | | | | | not the missing diagnostic. llvm-svn: 51365
* PR2347: Fix crash iterating over VLAs; this started triggering because Eli Friedman2008-05-211-0/+8
| | | | | | we now iterate over the whole AST when we destroy it. llvm-svn: 51363
* Fix the location we emit the "not a constant" error for this:Chris Lattner2007-12-181-0/+7
int foo() { typedef int x[foo()]; static int y = sizeof(x); } previously we'd emit it on the typedef, which made not sense at all. llvm-svn: 45154
OpenPOWER on IntegriCloud