]> Cypherpunks repositories - gostls13.git/commitdiff
c compiler bug tickled by
authorRuss Cox <rsc@golang.org>
Wed, 30 Sep 2009 17:25:22 +0000 (10:25 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 30 Sep 2009 17:25:22 +0000 (10:25 -0700)
void f(struct { int x[1]; } p) { }
the "int" was getting attached to f.

R=ken
OCL=35145
CL=35151

src/cmd/cc/cc.y

index 50d2ecdd87e4424dcdb69747111ddb7e84e2225e..0ade1d162cc18c073dcdeb24b169abe9e52b68a7 100644 (file)
@@ -44,6 +44,8 @@
        {
                Type*   t1;
                Type*   t2;
+               Type*   t3;
+               uchar   c;
        } tyty;
        struct
        {
@@ -925,16 +927,22 @@ sbody:
        {
                $<tyty>$.t1 = strf;
                $<tyty>$.t2 = strl;
+               $<tyty>$.t3 = lasttype;
+               $<tyty>$.c = lastclass;
                strf = T;
                strl = T;
                lastbit = 0;
                firstbit = 1;
+               lastclass = CXXX;
+               lasttype = T;
        }
        edecl '}'
        {
                $$ = strf;
                strf = $<tyty>2.t1;
                strl = $<tyty>2.t2;
+               lasttype = $<tyty>2.t3;
+               lastclass = $<tyty>2.c;
        }
 
 zctlist: