mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-25 15:31:05 +00:00
60 lines
2.0 KiB
Diff
60 lines
2.0 KiB
Diff
Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/60_all_gcc43-pr35440.patch
|
|
2008-03-19 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR c/35440
|
|
* c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR
|
|
for all types.
|
|
|
|
* gcc.dg/pr35440.c: New test.
|
|
|
|
diff -durN gcc-4.3.0.orig/gcc/c-pretty-print.c gcc-4.3.0/gcc/c-pretty-print.c
|
|
--- gcc-4.3.0.orig/gcc/c-pretty-print.c 2008-01-29 14:59:59.000000000 +0100
|
|
+++ gcc-4.3.0/gcc/c-pretty-print.c 2008-06-10 14:44:54.000000000 +0200
|
|
@@ -1173,6 +1173,12 @@
|
|
tree type = TREE_TYPE (e);
|
|
const enum tree_code code = TREE_CODE (type);
|
|
|
|
+ if (TREE_CODE (e) == CONSTRUCTOR)
|
|
+ {
|
|
+ pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
|
|
+ return;
|
|
+ }
|
|
+
|
|
switch (code)
|
|
{
|
|
case RECORD_TYPE:
|
|
@@ -1207,16 +1213,12 @@
|
|
case VECTOR_TYPE:
|
|
if (TREE_CODE (e) == VECTOR_CST)
|
|
pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e));
|
|
- else if (TREE_CODE (e) == CONSTRUCTOR)
|
|
- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
|
|
else
|
|
break;
|
|
return;
|
|
|
|
case COMPLEX_TYPE:
|
|
- if (TREE_CODE (e) == CONSTRUCTOR)
|
|
- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e));
|
|
- else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
|
|
+ if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR)
|
|
{
|
|
const bool cst = TREE_CODE (e) == COMPLEX_CST;
|
|
pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0));
|
|
diff -durN gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c
|
|
--- gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c 1970-01-01 01:00:00.000000000 +0100
|
|
+++ gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c 2008-06-10 14:44:54.000000000 +0200
|
|
@@ -0,0 +1,12 @@
|
|
+/* PR c/35440 */
|
|
+/* { dg-do compile } */
|
|
+/* { dg-options "-std=gnu99" } */
|
|
+
|
|
+struct A {};
|
|
+struct B { int i; char j[2]; };
|
|
+
|
|
+void foo (void)
|
|
+{
|
|
+ (struct A){}(); /* { dg-error "called object" } */
|
|
+ (struct B){ .i = 2, .j[1] = 1 }(); /* { dg-error "called object" } */
|
|
+}
|