[cfe-dev] clang -emit-llvm infinite recursion

Chris Lattner clattner at apple.com
Wed Oct 17 17:17:15 PDT 2007


On Oct 17, 2007, at 1:53 PM, Török Edvin wrote:

> Hi,
>
> Iit gives me errors [because struct initializers are not implemented,
> the errors are ok].
> I know that struct initializers are not yet implemented (right?), but
> then -emit-llvm should give an error if it can't handle something, and
> not infinite recursion.
>
> I would have used bugpoint to create a reduced testcase, but I don't
> know how to use it with clang, is it possible to use it?
>
> alex.i is available from here (it is a bit large):
> http://edwintorok.googlepages.com/alex.i
>
> $ clang -emit-llvm alex.i
> alex.i:661:19: warning: declaration does not declare anything
>     __extension__ union
>                   ^

There are two issues here.  The first warning you are getting (above)  
is due to us not handling anonymous unions like GCC does yet.  Since  
this is just a warning, I don't consider it to be a high priority  
right now.

The other issue is the array initialization case you hit.  Reduced,  
it looks like:

unsigned char asso_values[] = { 34 };
int test() { return asso_values[0]; }

$ clang t.c
t.c:3:21: error: illegal subscript of non-object type 'unsigned char  
(*)[]'
int test() { return asso_values[0]; }

I'm not sure where the failure is here.  Steve, should this set the  
type of asso_values to an array of size 1?  Or should the array type  
decay to pointer to element?  Is this something that would be  
reasonably easy to fix?

-Chris



More information about the cfe-dev mailing list