From 466a7f64bb43177b925c79372ba6b7dced505846 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 18 Aug 2006 07:38:36 +0000 Subject: [PATCH] 4.1.1-18 --- gcc41-pr27898.patch | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 gcc41-pr27898.patch diff --git a/gcc41-pr27898.patch b/gcc41-pr27898.patch new file mode 100644 index 0000000..9e11955 --- /dev/null +++ b/gcc41-pr27898.patch @@ -0,0 +1,92 @@ +2006-07-06 Alexandre Oliva + + PR c/27898 + * c-typeck.c (tagged_types_tu_compatible_p): Enable exact + matches between anonymous union fields. + +2006-08-18 Jakub Jelinek + + PR c/27898 + * gcc.dg/pr27898.c: New test. + +--- gcc/testsuite/gcc.dg/pr27898.c.jj 2006-08-18 09:19:33.000000000 +0200 ++++ gcc/testsuite/gcc.dg/pr27898.c 2006-08-18 09:19:27.000000000 +0200 +@@ -0,0 +1,8 @@ ++/* PR c/27898 */ ++/* { dg-do compile } */ ++/* { dg-options "--combine" } */ ++/* { dg-additional-sources "pr27898.c" } */ ++ ++union u { struct { int i; }; }; ++ ++extern int foo (union u *); +--- gcc/c-typeck.c.jj 2006-08-17 09:55:11.000000000 +0200 ++++ gcc/c-typeck.c 2006-08-18 09:14:15.000000000 +0200 +@@ -1126,11 +1126,12 @@ tagged_types_tu_compatible_p (tree t1, t + { + int result; + +- +- if (DECL_NAME (s1) == NULL +- || DECL_NAME (s1) != DECL_NAME (s2)) ++ if (DECL_NAME (s1) != DECL_NAME (s2)) + break; + result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); ++ ++ if (result != 1 && !DECL_NAME (s1)) ++ break; + if (result == 0) + { + tu->val = 0; +@@ -1157,28 +1158,31 @@ tagged_types_tu_compatible_p (tree t1, t + { + bool ok = false; + +- if (DECL_NAME (s1) != NULL) +- for (s2 = TYPE_FIELDS (t2); s2; s2 = TREE_CHAIN (s2)) +- if (DECL_NAME (s1) == DECL_NAME (s2)) +- { +- int result; +- result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); +- if (result == 0) +- { +- tu->val = 0; +- return 0; +- } +- if (result == 2) +- needs_warning = true; +- +- if (TREE_CODE (s1) == FIELD_DECL +- && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), +- DECL_FIELD_BIT_OFFSET (s2)) != 1) +- break; ++ for (s2 = TYPE_FIELDS (t2); s2; s2 = TREE_CHAIN (s2)) ++ if (DECL_NAME (s1) == DECL_NAME (s2)) ++ { ++ int result; ++ ++ result = comptypes_internal (TREE_TYPE (s1), TREE_TYPE (s2)); + +- ok = true; ++ if (result != 1 && !DECL_NAME (s1)) ++ continue; ++ if (result == 0) ++ { ++ tu->val = 0; ++ return 0; ++ } ++ if (result == 2) ++ needs_warning = true; ++ ++ if (TREE_CODE (s1) == FIELD_DECL ++ && simple_cst_equal (DECL_FIELD_BIT_OFFSET (s1), ++ DECL_FIELD_BIT_OFFSET (s2)) != 1) + break; +- } ++ ++ ok = true; ++ break; ++ } + if (!ok) + { + tu->val = 0;