summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-07-25 09:00:37 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-07-25 09:00:37 +0000
commitab085207aad52d58945ea30b78c04e050d7b5a9a (patch)
treecdaef3f76b7987573e0d77de853d8f8b8f7ccd5b /gcc
parent0abe00c528965ac8c84fed624ab93dc30e7636b9 (diff)
downloadgcc-ab085207aad52d58945ea30b78c04e050d7b5a9a.tar.gz
re PR c++/3543 (gcc-3.0 Internal error #56 in resolve_offset_ref, at cp/init.c:1963)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/expr.c7
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/optimize4.C31
5 files changed, 47 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6ae301c5c3a..9d1844dabb5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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 ...
(create_vtbl_ptr): ... here.
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index 6855160fc19..f2fe6ebf476 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -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;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 358037332d4..a6ddcf269f7 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bf7fe1c542b..abf5ae4c5e2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
2001-07-24 Jason Merrill <jason_merrill@redhat.com>
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
index 00000000000..7082e2cb951
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/optimize4.C
@@ -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();
+}