re PR tree-optimization/43068 (ICE: in estimate_operator_cost, at tree-inline.c:3141...
authorRichard Guenther <rguenther@suse.de>
Mon, 15 Feb 2010 11:27:54 +0000 (11:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 15 Feb 2010 11:27:54 +0000 (11:27 +0000)
2010-02-15  Richard Guenther  <rguenther@suse.de>

PR middle-end/43068
* cgraphunit.c (thunk_adjust): Skip adjusting by fixed_offset
if that is zero.

* g++.dg/torture/pr43068.C: New testcase.

From-SVN: r156770

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr43068.C [new file with mode: 0644]

index 2196c90e92d2a40cd7483e33b32e2fb1f504a194..b5148ebda1fe4344cb5148772fed32c4adc2c167 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-15  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/43068
+       * cgraphunit.c (thunk_adjust): Skip adjusting by fixed_offset
+       if that is zero.
+
 2010-02-15  Nick Clifton  <nickc@redhat.com>
 
        * config/mn10300/mn10300.h (FUNCTION_ARG_REGNO_P): Revert previous
index 9cd5f16f4889835598d4b6d6d15cb4114b08993c..ec7f9d8fc339b11e2b15923f718b330961c63f36 100644 (file)
@@ -1230,7 +1230,8 @@ thunk_adjust (gimple_stmt_iterator * bsi,
   gimple stmt;
   tree ret;
 
-  if (this_adjusting)
+  if (this_adjusting
+      && fixed_offset != 0)
     {
       stmt = gimple_build_assign (ptr,
                                  fold_build2_loc (input_location,
@@ -1315,7 +1316,8 @@ thunk_adjust (gimple_stmt_iterator * bsi,
                             offsettmp);
     }
 
-  if (!this_adjusting)
+  if (!this_adjusting
+      && fixed_offset != 0)
     /* Adjust the pointer by the constant.  */
     {
       tree ptrtmp;
index 4ad1e6742764074dd1d2e0c3323cc562e092a915..a06de9a9f4a56a3f3595cd5fb5fb121d9fd887d3 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-15  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/43068
+       * g++.dg/torture/pr43068.C: New testcase.
+
 2010-02-14  Volker Reichelt  <reichelt@gcc.gnu.org>
 
        PR c++/43024
diff --git a/gcc/testsuite/g++.dg/torture/pr43068.C b/gcc/testsuite/g++.dg/torture/pr43068.C
new file mode 100644 (file)
index 0000000..524fd23
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-freorder-blocks -ftracer} */
+
+struct A {
+    virtual A *f();
+};
+struct B : virtual A {
+    virtual B *f();
+};
+B *B::f() { return 0; }