From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Papadopoulo To: egcs@cygnus.com, egcs-bugs@cygnus.com Subject: A small bug... Date: Mon, 27 Apr 1998 02:30:00 -0000 Message-id: <199804270930.LAA13952@mururoa.inria.fr> X-SW-Source: 1998-04/msg01065.html The following piece of code consistently fails with egcs 19980418 on both sparc-sun-solaris2.5.1 and i586-pc-linux-gnulibc1. hawai->/0/robotvis/robotvis/egcs/bin/g++ Bug3.C Bug3.C:6: Internal compiler error. Bug3.C:6: Please submit a full bug report to `egcs-bugs@cygnus.com'. template class A { public: typedef enum { X, Y } B; template class Traits{ }; }; I append the gdb backtraces for linux and solaris at the end of this E-mail. As it seems, I'm just observing different effects of a deeper error, the tree node seeming to be corrupted in the two cases. Unfortunately, my knowledge of gcc/g++ do not allow me to go further easily (well in a reasonnable amount of time). I hope that this information is sufficient for the gurus :-) to find what is happening. If someone hints me about what to look at, I can try to run further tests if this can help. Thank's a lot, Theo. For linux: hawai->gdb /0/robotvis/robotvis/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.24/cc1plus rGDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...un (gdb) run Bug3.C -quiet -dumpbase Bug3.cc -version -o /tmp/cca00451.s Starting program: /0/robotvis/robotvis/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.24/cc1plus Bug3.C -quiet -dumpbase Bug3.cc -version -o /tmp/cca00451.s warning: Unable to find dynamic linker breakpoint function. warning: GDB will be unable to debug shared library initializers warning: and track explicitly loaded dynamic code. GNU C++ version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental) (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental). Program received signal SIGSEGV, Segmentation fault. 0x80ac80a in copy_node (node=0x821d4a0) at ../../egcs/gcc/tree.c:1180 1180 t = (tree) obstack_alloc (current_obstack, length); (gdb) p current_obstack $1 = (struct obstack *) 0x404 (gdb) watch current_obstack Hardware watchpoint 1: current_obstack (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /0/robotvis/robotvis/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.24/cc1plus Bug3.C -quiet -dumpbase Bug3.cc -version -o /tmp/cca00516.s warning: Unable to find dynamic linker breakpoint function. warning: GDB will be unable to debug shared library initializers warning: and track explicitly loaded dynamic code. GNU C++ version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental) (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental). Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x0 New value = (struct obstack *) 0x81ef140 init_obstacks () at ../../egcs/gcc/tree.c:292 292 rtl_obstack = saveable_obstack = &permanent_obstack; (gdb) c Continuing. Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x81ef140 New value = (struct obstack *) 0x81e89f8 decl_tree_cons (purpose=0x0, value=0x821cf50, chain=0x820575c) at ../../egcs/gcc/tree.c:2086 2086 node = tree_cons (purpose, value, chain); (gdb) c Continuing. Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x81e89f8 New value = (struct obstack *) 0x81ef140 decl_tree_cons (purpose=0x0, value=0x821cf50, chain=0x820575c) at ../../egcs/gcc/tree.c:2089 2089 } (gdb) c Continuing. Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x81ef140 New value = (struct obstack *) 0x81e89f8 build_decl_list (parm=0x0, value=0x821d268) at ../../egcs/gcc/tree.c:2026 2026 node = build_tree_list (parm, value); (gdb) c Continuing. Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x81e89f8 New value = (struct obstack *) 0x81ef140 build_decl_list (parm=0x0, value=0x821d268) at ../../egcs/gcc/tree.c:2029 2029 } (gdb) c Continuing. Hardware watchpoint 1: current_obstack Old value = (struct obstack *) 0x81ef140 New value = (struct obstack *) 0x404 build_type_copy (type=0x821d4a0) at ../../egcs/gcc/tree.c:3615 3615 register tree t, m = TYPE_MAIN_VARIANT (type); Yet another run to the place where current_obstack seems to get a wrong value: Breakpoint 2, build_type_copy (type=0x821d4a0) at ../../egcs/gcc/tree.c:3618 3618 current_obstack = TYPE_OBSTACK (type); (gdb) print debug_tree(type) > chain >>> context > chain > allocated from permanent_obstack permanent index 0 level 2 orig_level 2> $5 = void (gdb) p type->type $6 = {common = "\000\000\000\000PÏ!\b\217\004\000", values = 0x0, size = 0x0, attributes = 0x2, uid = 2, precision = 72 'H', mode = 212, string_flag = 1, no_force_blk_flag = 0, needs_constructing_flag = 0, transparent_union_flag = 0, packed_flag = 0, lang_flag_0 = 1, lang_flag_1 = 0, lang_flag_2 = 0, lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 1, align = 0, pointer_to = 0x0, reference_to = 0x403, symtab = { address = 136434548, pointer = 0x821d374 ""}, name = 0x0, minval = 0x0, maxval = 0x0, next_variant = 0x403, main_variant = 0x0, binfo = 0x821d3f0, noncopied_parts = 0x0, context = 0x821e860, obstack = 0x404, lang_specific = 0x1} For Solaris: (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /u/corse/2/robotvis/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.24/cc1plus Bug3.C -quiet -dumpbase Bug3.cc -version -o /var/tmp/cca0032H.s GNU C++ version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.91.24 19980418 (gcc2 ss-980401 experimental). Program received signal SIGSEGV, Segmentation fault. build_type_variant (type=0x29ab70, constp=0, volatilep=0) at ../../egcs/gcc/tree.c:3595 3595 if (constp == TYPE_READONLY (t) && volatilep == TYPE_VOLATILE (t) (gdb) p t $2 = 0x3200000 (gdb) p type->type $15 = {common = "\000\000\000\000\000)¥À\217 \000", values = 0x0, size = 0x0, attributes = 0x2, uid = 2, precision = 0 '\000', mode = 41, string_flag = 1, no_force_blk_flag = 0, needs_constructing_flag = 1, transparent_union_flag = 0, packed_flag = 1, lang_flag_0 = 0, lang_flag_1 = 1, lang_flag_2 = 1, lang_flag_3 = 0, lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 1, align = 0, pointer_to = 0x0, reference_to = 0x3200000, symtab = {address = 2730544, pointer = 0x29aa30 ""}, name = 0x0, minval = 0x0, maxval = 0x0, next_variant = 0x0, main_variant = 0x3200000, binfo = 0x0, noncopied_parts = 0x29aac0, context = 0x0, obstack = 0x0, lang_specific = 0x29ae80} -------------------------------------------------------------------- Theodore Papadopoulo Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01 --------------------------------------------------------------------