This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
gcc-3.0 branch digest_init
- To: gcc-patches at gcc dot gnu dot org
- Subject: gcc-3.0 branch digest_init
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Sat, 17 Mar 2001 17:20:07 +1100 (EST)
- cc: Matt Taggart <taggart at fc dot hp dot com>
digest_init was calling initializer_constant_valid_p with an expression
that violated icvp's assumption that VALUE has been folded as much as
possible.
testcase:
$ cat consinit.i
extern void _text;
static unsigned long x = (unsigned long) &_text - 0x10000000L - 1;
$ gcc_new/gcc/xgcc -v -S consinit.i
[snip]
GNU C version 3.0 20010315 (prerelease) (hppa-linux)
compiled by GNU C version 2.95.2 19991024 (release).
consinit.i:2: warning: initializer element is not computable at load time
consinit.i:2: Internal error: Segmentation fault
Possible fix:
* c-typeck.c (digest_init): Fold init expression.
--- gcc/c-typeck.c~ Fri Mar 16 09:57:01 2001
+++ gcc/c-typeck.c Sat Mar 17 16:44:32 2001
@@ -4662,7 +4662,7 @@ digest_init (type, init, require_constan
int require_constant, constructor_constant;
{
enum tree_code code = TREE_CODE (type);
- tree inside_init = init;
+ tree inside_init = fold (init);
if (type == error_mark_node
|| init == error_mark_node
Alan Modra
--
Linuxcare