re PR tree-optimization/22404 (ICE in first_vi_for_offset)
authorDaniel Berlin <dberlin@dberlin.org>
Mon, 11 Jul 2005 18:28:36 +0000 (18:28 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Mon, 11 Jul 2005 18:28:36 +0000 (18:28 +0000)
2005-07-11  Daniel Berlin  <dberlin@dberlin.org>

* print-tree.c (print_node): Use DECL_ARGUMENT_FLD.
* tree.h (DECL_ARGUMENT_FLD): New macro.

2005-07-11  Daniel Berlin  <dberlin@dberlin.org>

Fix PR tree-optimization/22404

* tree-ssa-structalias.c (create_variable_info_for): Use
correct offset.

From-SVN: r101894

gcc/ChangeLog
gcc/print-tree.c
gcc/testsuite/g++.dg/tree-ssa/pr22404.C [new file with mode: 0644]
gcc/tree-ssa-structalias.c
gcc/tree.h

index e1b5b633fd168e1f0465bcd099dae1446f73a733..9cd1d7581112ce130b082018e8ec79013fcc3e14 100644 (file)
@@ -1,3 +1,15 @@
+2005-07-11  Daniel Berlin  <dberlin@dberlin.org>
+       
+       * print-tree.c (print_node): Use DECL_ARGUMENT_FLD.
+       * tree.h (DECL_ARGUMENT_FLD): New macro.
+
+2005-07-11  Daniel Berlin  <dberlin@dberlin.org>
+       
+       Fix PR tree-optimization/22404
+
+       * tree-ssa-structalias.c (create_variable_info_for): Use
+       correct offset.
+
 2005-07-11  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/bfin.md (cmpsi, compare_eq, compare_ne, compare_lt,
index 9bd79f4452e95dd1a2b670df54ef7d3cf307e916..954ee2d6a9c79ee1cec72c01b0a81de81da8a9ee 100644 (file)
@@ -467,7 +467,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
        }
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
        {
-         print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
+         print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
          print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
        }
       print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr22404.C b/gcc/testsuite/g++.dg/tree-ssa/pr22404.C
new file mode 100644 (file)
index 0000000..2c6b8cd
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* We were not getting the offset of a in B and a in C::B correct, 
+   causing an abort.  */
+struct A { A(); };
+
+struct B : A
+{
+    A a;
+};
+
+struct C : B { };
+
+C c;
index 6f89799d00adcef4134dd5d2773e2a0557b1ca9d..27299e764bc8a3b69a6b15a92caed3fa24546331 100644 (file)
@@ -3065,6 +3065,7 @@ create_variable_info_for (tree decl, const char *name)
       
       field = fo->field;
       vi->size = TREE_INT_CST_LOW (DECL_SIZE (field));
+      vi->offset = fo->offset;
       for (i = 1; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++)
        {
          varinfo_t newvi;
index eb9ebdcd05dc3df2595712efff93f778387b4961..e1007a3caed1532ebab028db873e5b8071abf2f7 100644 (file)
@@ -2631,6 +2631,7 @@ struct tree_decl_non_common GTY(())
    VAR_DECL and PARM_DECL reserve the arguments slot for language-specific
    uses.  */
 #define DECL_ARGUMENTS(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.arguments)
+#define DECL_ARGUMENT_FLD(NODE) (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments)
 
 /* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the
    arguments/result/saved_tree fields by front ends.   It was either inherit