]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/3543 (gcc-3.0 Internal error #56 in resolve_offset_ref, at cp/init.c:1963)
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 25 Jul 2001 09:00:37 +0000 (09:00 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 25 Jul 2001 09:00:37 +0000 (09:00 +0000)
cp:
PR c++/3543
* typeck.c (condition_conversion): Resolve an OFFSET_REF.
* expr.c (cplus_expand_expr): An OFFSET_REF should never get here.
testsuite:
* g++.old-deja/g++.other/optimize4.C: New test.

From-SVN: r44340

gcc/cp/ChangeLog
gcc/cp/expr.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.other/optimize4.C [new file with mode: 0644]

index 6ae301c5c3a5078290037916880a47b0c8116382..9d1844dabb52c4831388850c6668bea06b9f09f3 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-25  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/3543
+       * typeck.c (condition_conversion): Resolve an OFFSET_REF.
+       * expr.c (cplus_expand_expr): An OFFSET_REF should never get here.
+
 2001-07-25  Nathan Sidwell  <nathan@codesourcery.com>
 
        * class.c (build_vtbl_or_vbase_field): Remove, move into ...
index 6855160fc19070c66b8a7352f8b759c838ff6abc..f2fe6ebf4768ec20d03d34dc7e15caf81ace590d 100644 (file)
@@ -105,9 +105,10 @@ cplus_expand_expr (exp, target, tmode, modifier)
                          target, tmode, modifier);
 
     case OFFSET_REF:
-      return expand_expr (default_conversion (resolve_offset_ref (exp)),
-                         target, tmode, EXPAND_NORMAL);
-
+      /* Offset refs should not make it through to here. */
+      my_friendly_abort (20010724);
+      return const0_rtx;
+      
     case THROW_EXPR:
       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
       return NULL;
index 358037332d4580c5fba768741e7f73e2371d5dca..a6ddcf269f765ac0d269911d9d4380f966aed76c 100644 (file)
@@ -4331,6 +4331,8 @@ condition_conversion (expr)
   tree t;
   if (processing_template_decl)
     return expr;
+  if (TREE_CODE (expr) == OFFSET_REF)
+    expr = resolve_offset_ref (expr);
   t = perform_implicit_conversion (boolean_type_node, expr);
   t = fold (build1 (CLEANUP_POINT_EXPR, boolean_type_node, t));
   return t;
index bf7fe1c542be38b7777b18180ad8f59ec10ae214..abf5ae4c5e279c14bef3ea0f83f62572436c18a4 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-25  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.old-deja/g++.other/optimize4.C: New test.
+
 2001-07-25  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.abi/vbase8-5.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.other/optimize4.C b/gcc/testsuite/g++.old-deja/g++.other/optimize4.C
new file mode 100644 (file)
index 0000000..7082e2c
--- /dev/null
@@ -0,0 +1,31 @@
+// Build don't link:
+// 
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 Jul 2001 <nathan@codesourcery.com>
+
+// Bug 3543. We forgot to resolve an OFFSET_REF
+
+
+struct Writeable {
+  bool blocking_mode;
+};
+
+
+struct Pipe : Writeable {
+  void ewrite();
+
+  void set_write_blocking ()
+  {
+    if (Writeable::blocking_mode);
+  }
+};
+
+void Pipe::ewrite()
+{
+  set_write_blocking();
+}
+
+void ewrite(Pipe &p)
+{
+  p.set_write_blocking();
+}