Summary: | Wrong Message of -Wvla for Standard ISO C90 However Emitted with -std=c11 | ||
---|---|---|---|
Product: | gcc | Reporter: | Chengnian Sun <chengniansun> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | manu, msebor |
Priority: | P3 | Keywords: | diagnostic, documentation |
Version: | 6.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2015-08-16 00:00:00 |
Description
Chengnian Sun
2015-08-16 22:12:09 UTC
It is also useless to give such warning after such error. I'm afraid the way GCC reports most extensions is very fragile in this way. It doesn't affect only Wvla. It would be nice to discuss/design/agree on a canonical and future-proof way to report: * Pure GNU extensions, not accepted by any standard. * Features accepted by some standard but that are extensions for other standards (like C++ style comments). The latter requires some future-proof way of reporting: * Extensions that are forbidden up to a particular standard. * Extensions that were accepted but are forbidden now (not sure if there is such case at all). (It is kind of ironic that Clang is fair more clear pointing out when something is a "GNU extension". In some way, Clang is doing more promotion of GNU than GCC!) Moreover, since VLAs are not an extension in C99, the text of Wvla is wrong always for -std=c99. void square(int num) { int array[num]; } With -std=c99 -Wpedantic there is no warning. With -std=c99 -Wvla, it mentions ISO C90, which is irrelevant. Clang just says: "variable length array used" *** Bug 67237 has been marked as a duplicate of this bug. *** *** Bug 67236 has been marked as a duplicate of this bug. *** *** Bug 67235 has been marked as a duplicate of this bug. *** *** Bug 67234 has been marked as a duplicate of this bug. *** *** Bug 67233 has been marked as a duplicate of this bug. *** *** Bug 67232 has been marked as a duplicate of this bug. *** *** Bug 67231 has been marked as a duplicate of this bug. *** *** Bug 67230 has been marked as a duplicate of this bug. *** (In reply to Marek Polacek from comment #10) > *** Bug 67230 has been marked as a duplicate of this bug. *** Sorry, Marek. I did not realize that I had submitted so many duplicate reports. I got gateway errors from GCC bugzilla that night when I was submitting this bug report. I tried several times and it seems they all went through despite the errors. No problem. I suspected it was something like that. Another case is -Wdeclaration-after-statement: int fn (int m) { if (m > 0) return -1; int a; } *** Bug 71925 has been marked as a duplicate of this bug. *** |