This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error with pointers to members.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Internal compiler error with pointers to members.
- From: Andrew Lewycky <amplewycky at undergrad dot math dot uwaterloo dot ca>
- Date: Mon, 30 Aug 1999 22:30:03 -0400
- CC: duz at rtsffm dot com
I am not a gcc hacker, but I encountered the same problem as you and
have developed a potential patch. This is in the "it works for me"
category as I do not have a copy of the testsuite. (Tomorrow I will be
compiling a large application with it, so I'll see then.)
The bug: a PTRMEM_CST node gets into const_hash contained in a
CONSTRUCTOR's CONSTRUCTOR_ELT chain. const_hash can't handle PTRMEM_CSTs
because they are C++-specific. const_hash is called from
output_constant_def.
My fix: Have cplus_expand_constant look inside CONSTRUCTOR nodes for
other C++-specific constant nodes. (Perhaps it was thought that all
constants were leaf nodes, so there was no need to recurse?) And have
output_constant_def call lang_expand_constant, like output_constant.
This fixes a testcase I had (very similar to yours) as well as your
testcase.
Are there any other nodes that cplus_expand_constant should look into?
Andrew Lewycky
amplewycky@uwaterloo.ca
Mon Aug 30 22:16:09 EDT 1999 Andrew Lewycky (amplewycky@uwaterloo.ca)
* varasm.c (output_constant_def): call lang_expand_constant
* cp/expr.c (cplus_expand_consant): recurse inside CONSTRUCTORs
diff -c3pr gcc-2.95.1-orig/gcc/cp/expr.c gcc-2.95.1/gcc/cp/expr.c
*** gcc-2.95.1-orig/gcc/cp/expr.c Thu May 20 06:48:34 1999
--- gcc-2.95.1/gcc/cp/expr.c Mon Aug 30 21:39:03 1999
*************** cplus_expand_constant (cst)
*** 84,89 ****
--- 84,101 ----
}
break;
+ case CONSTRUCTOR:
+ {
+ tree link;
+ for (link = CONSTRUCTOR_ELTS (cst); link; link = TREE_CHAIN (link))
+ {
+ tree value = TREE_VALUE(link);
+ if (value)
+ TREE_VALUE(link) = cplus_expand_constant(value);
+ }
+ }
+ break;
+
default:
/* There's nothing to do. */
break;
diff -c3pr gcc-2.95.1-orig/gcc/varasm.c gcc-2.95.1/gcc/varasm.c
*** gcc-2.95.1-orig/gcc/varasm.c Wed Jun 9 08:13:49 1999
--- gcc-2.95.1/gcc/varasm.c Mon Aug 30 21:41:52 1999
*************** output_constant_def (exp)
*** 2933,2938 ****
--- 2933,2941 ----
int reloc;
register rtx def;
+ if (lang_expand_constant)
+ exp = (*lang_expand_constant) (exp);
+
if (TREE_CST_RTL (exp))
return TREE_CST_RTL (exp);