tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] struct initializer bug


From: Mark
Subject: Re: [Tinycc-devel] struct initializer bug
Date: Fri, 23 Feb 2007 08:51:40 -0600

Do you have a single step execution debugger with your version? It sounds like if you single stepped it, you might find that a function detour is being taken before that point, confusing the compiler...

Try writing an initalizer function that takes precedence even to main() so that the declarations are known as in top down programming....

I will wait to hear of your success. You will lick it in no time.

----- Original Message ----- From: "Dave Dodge" <address@hidden>
To: <address@hidden>
Sent: Friday, February 23, 2007 7:12 AM
Subject: [Tinycc-devel] struct initializer bug


I have some recent code that uses a lot of elaborate initializers, and
more than one file triggered this error.  It says "field expected" for
the line containing the .v initializer in the second structure,
perhaps as if it doesn't think that the .p initializer is finished.  I
only briefly glanced at the compiler and it looks like it's got to be
in decl_designator() since that's the only function that produces this
error message.  Minor changes, such as removing the "y" field from
struct point, or removing the ".v" initializer, make the error go
away.

                                                 -Dave Dodge




struct point{
       int x,y;
};

struct obj{
       struct point p;
       int v;
};

void foo(void)
{
       /* this works */
       struct obj zz1 = {
               .p = (struct point){ .x = 0 },
               .v = 0
       };

       /* this does not */
       struct point p = { .x = 0 };
       struct obj zz2 = {
               .p = p,
               .v = 0
       }
}


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/697 - Release Date: 2/22/2007 11:55 AM







reply via email to

[Prev in Thread] Current Thread [Next in Thread]