diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.3.3/fedora/gcc43-pr35440.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.3.3/fedora/gcc43-pr35440.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.3.3/fedora/gcc43-pr35440.patch b/meta/recipes-devtools/gcc/gcc-4.3.3/fedora/gcc43-pr35440.patch new file mode 100644 index 0000000000..6bf3f0d9d8 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.3.3/fedora/gcc43-pr35440.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | 2008-03-19 Jakub Jelinek <jakub@redhat.com> | ||
2 | |||
3 | PR c/35440 | ||
4 | * c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR | ||
5 | for all types. | ||
6 | |||
7 | * gcc.dg/pr35440.c: New test. | ||
8 | |||
9 | --- gcc/c-pretty-print.c.jj 2008-02-11 14:48:12.000000000 +0100 | ||
10 | +++ gcc/c-pretty-print.c 2008-03-19 14:50:09.000000000 +0100 | ||
11 | @@ -1173,6 +1173,12 @@ pp_c_initializer_list (c_pretty_printer | ||
12 | tree type = TREE_TYPE (e); | ||
13 | const enum tree_code code = TREE_CODE (type); | ||
14 | |||
15 | + if (TREE_CODE (e) == CONSTRUCTOR) | ||
16 | + { | ||
17 | + pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); | ||
18 | + return; | ||
19 | + } | ||
20 | + | ||
21 | switch (code) | ||
22 | { | ||
23 | case RECORD_TYPE: | ||
24 | @@ -1207,16 +1213,12 @@ pp_c_initializer_list (c_pretty_printer | ||
25 | case VECTOR_TYPE: | ||
26 | if (TREE_CODE (e) == VECTOR_CST) | ||
27 | pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); | ||
28 | - else if (TREE_CODE (e) == CONSTRUCTOR) | ||
29 | - pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); | ||
30 | else | ||
31 | break; | ||
32 | return; | ||
33 | |||
34 | case COMPLEX_TYPE: | ||
35 | - if (TREE_CODE (e) == CONSTRUCTOR) | ||
36 | - pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); | ||
37 | - else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) | ||
38 | + if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) | ||
39 | { | ||
40 | const bool cst = TREE_CODE (e) == COMPLEX_CST; | ||
41 | pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0)); | ||
42 | --- gcc/testsuite/gcc.dg/pr35440.c.jj 2008-03-19 15:57:13.000000000 +0100 | ||
43 | +++ gcc/testsuite/gcc.dg/pr35440.c 2008-03-19 15:47:35.000000000 +0100 | ||
44 | @@ -0,0 +1,12 @@ | ||
45 | +/* PR c/35440 */ | ||
46 | +/* { dg-do compile } */ | ||
47 | +/* { dg-options "-std=gnu99" } */ | ||
48 | + | ||
49 | +struct A {}; | ||
50 | +struct B { int i; char j[2]; }; | ||
51 | + | ||
52 | +void foo (void) | ||
53 | +{ | ||
54 | + (struct A){}(); /* { dg-error "called object" } */ | ||
55 | + (struct B){ .i = 2, .j[1] = 1 }(); /* { dg-error "called object" } */ | ||
56 | +} | ||