Contents of /trunk/gcc/patches/gcc-4.0.2-compound-literal-fix.patch
Parent Directory | Revision Log
Revision 169 -
(show annotations)
(download)
Tue May 8 21:36:54 2007 UTC (17 years, 4 months ago) by niro
File size: 2032 byte(s)
Tue May 8 21:36:54 2007 UTC (17 years, 4 months ago) by niro
File size: 2032 byte(s)
-moved to patches subdir
1 | fixes compound literal issues with kernel modules |
2 | |
3 | see https://www.redhat.com/archives/fedora-devel-list/2005-September/msg00554.html |
4 | and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24109 |
5 | |
6 | =================================================================== |
7 | diff -Naur gcc-4.0.2/gcc/c-decl.c gcc-4.0.2-fixed/gcc/c-decl.c |
8 | --- gcc-4.0.2/gcc/c-decl.c 2005-09-09 00:51:44.000000000 +0000 |
9 | +++ gcc-4.0.2-fixed/gcc/c-decl.c 2005-10-19 19:39:55.000000000 +0000 |
10 | @@ -7527,6 +7527,7 @@ |
11 | c_write_global_declarations_1 (tree globals) |
12 | { |
13 | tree decl; |
14 | + bool reconsider; |
15 | |
16 | /* Process the decls in the order they were written. */ |
17 | for (decl = globals; decl; decl = TREE_CHAIN (decl)) |
18 | @@ -7545,9 +7546,18 @@ |
19 | } |
20 | |
21 | wrapup_global_declaration_1 (decl); |
22 | - wrapup_global_declaration_2 (decl); |
23 | - check_global_declaration_1 (decl); |
24 | } |
25 | + |
26 | + do |
27 | + { |
28 | + reconsider = false; |
29 | + for (decl = globals; decl; decl = TREE_CHAIN (decl)) |
30 | + reconsider |= wrapup_global_declaration_2 (decl); |
31 | + } |
32 | + while (reconsider); |
33 | + |
34 | + for (decl = globals; decl; decl = TREE_CHAIN (decl)) |
35 | + check_global_declaration_1 (decl); |
36 | } |
37 | |
38 | /* A subroutine of c_write_global_declarations Emit debug information for each |
39 | diff -Naur gcc-4.0.2/gcc/testsuite/gcc.c-torture/execute/20050929-1.c gcc-4.0.2-fixed/gcc/testsuite/gcc.c-torture/execute/20050929-1.c |
40 | --- gcc-4.0.2/gcc/testsuite/gcc.c-torture/execute/20050929-1.c 1970-01-01 00:00:00.000000000 +0000 |
41 | +++ gcc-4.0.2-fixed/gcc/testsuite/gcc.c-torture/execute/20050929-1.c 2005-10-19 19:41:37.000000000 +0000 |
42 | @@ -0,0 +1,20 @@ |
43 | +/* PR middle-end/24109 */ |
44 | + |
45 | +extern void abort (void); |
46 | + |
47 | +struct A { int i; int j; }; |
48 | +struct B { struct A *a; struct A *b; }; |
49 | +struct C { struct B *c; struct A *d; }; |
50 | +struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } }; |
51 | + |
52 | +int |
53 | +main (void) |
54 | +{ |
55 | + if (e.c->a->i != 1 || e.c->a->j != 2) |
56 | + abort (); |
57 | + if (e.c->b->i != 3 || e.c->b->j != 4) |
58 | + abort (); |
59 | + if (e.d->i != 5 || e.d->j != 6) |
60 | + abort (); |
61 | + return 0; |
62 | +} |