Brian Sidebotham wrote:
Brian Sidebotham wrote:
../../gcc/gcc/tree.c: In function "build_string":
../../gcc/gcc/tree.c:1197: internal compiler error: in
iterative_hash_expr, at tree.c:4189
Please submit a full bug report,
with preprocessed source if appropriate.
I have placed the pre-processed file here:
http://www.valvers.com/gcc/arm-elf/tree.i (1.5Mb)
The following configure line was used:
../gcc/configure --target=arm-elf --prefix=${installdir} --with-newlib
--with-headers=${newlibdir}/src/newlib/libc/include
--enable-languages=c,c++ --enable-interwork --enable-multilib
codebase is svn revision 127732
The failing command line is:
gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -Wmissing-format-attribute -fno-common
-DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/.
-I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd
-I../libdecnumber ../../gcc/gcc/tree.c -o tree.o
and lastly, the specs of the gcc compiler being used are:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --with-tune=pentium4
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
These are the two lines that fail:
tree.c:1197: memcpy (CONST_CAST (TREE_STRING_POINTER (s)), str, len);
memcpy (((__extension__(union {__typeof(((const char
*)(STRING_CST_CHECK (s)->string.str)))_q; void *_v;})(((const char
*)(STRING_CST_CHECK (s)->string.str))))._v), str, len);
tree.c:1198: ((char *) CONST_CAST (TREE_STRING_POINTER (s)))[len] = '\0';
((char *) ((__extension__(union {__typeof(((const char
*)(STRING_CST_CHECK (s)->string.str)))_q; void *_v;})(((const char
*)(STRING_CST_CHECK (s)->string.str))))._v))[len] = '\0';
Removing the CONST_CAST delcarlations allows compilation of gcc to
complete with a warning (as expected)
../../gcc/gcc/tree.c: In function 'build_string':
../../gcc/gcc/tree.c:1197: warning: passing argument 1 of âmemcpyâ
discards qualifiers from pointer target type
This ICE is caused by the following patch:
2007-08-10 Kaveh R. Ghazi <[EMAIL PROTECTED]>
* system.h (CONST_CAST): New.
* c-decl.c (c_make_fname_decl): Use it.
* c-lex.c (cb_ident, lex_string): Likewise.
* c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
* gcc.c (set_spec, read_specs, for_each_path, execute, do_spec_1,
give_switch, set_multilib_dir): Likewise.
* gengtype-parse.c (string_seq, typedef_name): Likewise.
* passes.c (execute_one_pass): Likewise.
* prefix.c (update_path): Likewise.
* pretty-print.c (pp_base_destroy_prefix): Likewise.
* tree.c (build_string): Likewise.
Reverting this patch lets gcc build again.
Unfortunately, CONST_CAST is a mystery to me (I don't understand it!) so there
is no hope of me changing it to compile okay AND be right!
Best Regards,
Brian Sidebotham.