[cfe-commits] r65140 - in /cfe/trunk: lib/Sema/SemaDecl.cpp lib/Sema/SemaType.cpp test/Sema/typedef-variable-type.c

Eli Friedman eli.friedman at gmail.com
Fri Feb 20 17:23:59 PST 2009


On Fri, Feb 20, 2009 at 5:11 PM, Anders Carlsson <andersca at mac.com> wrote:
>
> On Friday, February 20, 2009, at 04:35PM, "Eli Friedman" <eli.friedman at gmail.com> wrote:
>>On Fri, Feb 20, 2009 at 10:53 AM, Anders Carlsson <andersca at mac.com> wrote:
>>> Author: andersca
>>> Date: Fri Feb 20 12:53:20 2009
>>> New Revision: 65140
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=65140&view=rev
>>> Log:
>>> Always try to fold array sizes, and warn if we could fold something that isn't an ICE. This makes us compatible with GCC.
>>
>>And incompatible with the standard!  The solution we were using was
>>picked with good reason: VLAs type compatibility rules are different
>>such that the difference is visible to the user.
>
> At this stage I think it's more important to actually be able to _compile_ code. The reason I fixed this was that I had encountered real code that was relying on this.

I'm aware of that... which is why I fixed it for you :)

>  Also, this patch
>>will warn on perfectly legitimate cases, like the following:
>>int a() {
>>int x[!0.0];
>>x[0] = 2;
>>return x[0];
>>}
>
> One fix would be to just try to do the folding for non-local declarations of arrays. (In addition to arrays in fields).

That's a possibility... if it starts getting too difficult to deal
with TryToFixInvalidVariablyModifiedType, I'll look into that.

-Eli



More information about the cfe-commits mailing list