From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John David Anglin" To: dave@hiauly1.hia.nrc.ca (John David Anglin) Cc: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: Where's the axe? Can't walk_tree. Date: Sat, 14 Apr 2001 14:20:00 -0000 Message-id: <200104142120.RAA19504@hiauly1.hia.nrc.ca> References: X-SW-Source: 2001-04/msg00817.html I have enclosed a patch for review. It has been bootstrap tested under i686 linux with PCC_STATIC_STRUCT_RETURN defined in linux.h. The build of libstdc++-v3 under vax ultrix goes much further than ever before but there are still problems: /xxx/gnu/gcc-3.0/objdir/gcc/xgcc -B/xxx/gnu/gcc-3.0/objdir/gcc/ -nostdinc++ -L/xxx/gnu/gcc-3.0/objdir/vax-dec-ultrix4.3/libstdc++-v3/src -L/xxx/gnu/gcc-3.0/objdir/vax-dec-ultrix4.3/libstdc++-v3/src/.libs -B/usr/local/vax-dec-ultrix4.3/bin/ -B/usr/local/vax-dec-ultrix4.3/lib/ -isystem /usr/local/vax-dec-ultrix4.3/include -nostdinc++ -I../../../../libstdc++-v3/include -I../../../../libstdc++-v3/include/std -I../../../../libstdc++-v3/include/c_std -I../include -I../../../../libstdc++-v3/libsupc++ -I../libio -I../../../../libstdc++-v3/libio -I../../../../libstdc++-v3/libmath -g -O2 -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -g -c ../../../../libstdc++-v3/src/misc-inst.cc -o misc-inst.o ../../../../libstdc++-v3/include/bits/basic_string.h: In function `std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]': ../../../../libstdc++-v3/src/misc-inst.cc:189: instantiated from here ../../../../libstdc++-v3/include/bits/basic_string.h:1133: warning: comparison between signed and unsigned integer expressions /usr/tmp/ccsCMPtL.s: Assembler messages: /usr/tmp/ccsCMPtL.s:45114: Error: Attempt to get value of unresolved symbol __n:V28 /usr/tmp/ccsCMPtL.s:45114: Error: Attempt to get value of unresolved symbol __n: V28 /usr/tmp/ccsCMPtL.s:45114: Error: Attempt to get value of unresolved symbol /usr/tmp/ccsCMPtL.s:45114: Error: Attempt to get value of unresolved symbol make[4]: *** [misc-inst.lo] Error 1 The problem causing the infinite recursion was the call to build_aggr_init in simplify_aggr_init_exprs_r. It converted the just built call_expr back to an expression containing another aggr_init_expr. > > The following error occurs compiling cinst.cc under vax ultrix 4.3: > > /xxx/gnu/gcc-2.97/objdir/gcc/g++ -B/xxx/gnu/gcc-2.97/objdir/gcc/ -nostdinc++ -isystem /xxx/gnu/gcc-2.97/libstdc++ -isystem /xxx/gnu/gcc-2.97/libstdc++/std -isystem /xxx/gnu/gcc-2.97/libstdc++/stl -isystem /xxx/gnu/gcc-2.97/libio -isystem /xxx/gnu/gcc-2.97/objdir/vax-dec-ultrix4.3/libio -L/xxx/gnu/gcc-2.97/objdir/vax-dec-ultrix4.3/libstdc++ -B/usr/local/vax-dec-ultrix4.3/bin/ -B/usr/local/vax-dec-ultrix4.3/lib/ -isystem /usr/local/vax-dec-ultrix4.3/include -c -O3 -fno-implicit-templates -I../../../libstdc++ -I../../../libstdc++/stl -I../libio -I../../../libstdc++/../libio -I../../../libstdc++/../include -I../../../libstdc++/../gcc -nostdinc++ -DF `for N in MAIN ADDCC ADDCF ADDFC SUBCC SUBCF SUBFC MULCC MULCF MULFC DIVCC DIVCF DIVFC PLUS MINUS EQCC EQCF EQFC NECC NECF NEFC ABS ARG POLAR CONJ NORM COS COSH EXP LOG POWCC POWCF POWCI POWFC SIN SINH SQRT; do echo " -D${N}"; done` \ > ../../../libstdc++/cinst.cc -o fcomplex.o > ../libio/_G_config.h:85: warning: badly nested C headers from preprocessor > ../../../libstdc++/cmath:6: warning: badly nested C headers from preprocessor > g++: Internal error: Illegal instruction (program cc1plus) > Please submit a full bug report. > See for instructions. > make[1]: *** [bigstmp-complx] Error 1 > make[1]: Leaving directory `/xxx/gnu/gcc-2.97/objdir/vax-dec-ultrix4.3/libstdc++' > make: *** [all-target-libstdc++] Error 2 > Wed Nov 29 07:51:59 EST 2000 > > The internal error is caused by cc1plus exceeding the maximum stack size. > It occurs processing the header fcomplex.h for the function > const complex operator+(const complex&, float). For some > reason, the recursive calls to walk the tree lead to infinite recursion: > > (gdb) bt -10 > #18906 0xe9d66 in walk_tree (tp=0x3ffbd4, > func=0xe40ac , data=0x0, > htab=0x308700, 3180288, 1) at ../../gcc/cp/tree.c:1286 > #18907 0xe9d66 in walk_tree (tp=0x3ffbf0, > func=0xe40ac , data=0x0, htab=0x308700) > at ../../gcc/cp/tree.c:1286 > #18908 0xe9d66 in walk_tree (tp=0x3fd160, > func=0xe40ac , data=0x0, htab=0x308700) > at ../../gcc/cp/tree.c:1286 > #18909 0xe9da3 in walk_tree (tp=0x3fd150, > func=0xe40ac , data=0x0, htab=0x308700) > at ../../gcc/cp/tree.c:1307 > #18910 0xe9d66 in walk_tree (tp=0x3dbb80, > func=0xe40ac , data=0x0, htab=0x308700) > at ../../gcc/cp/tree.c:1286 > #18911 0xed91c in walk_tree_without_duplicates (tp=0x3dbb80, > func=0xe40ac , data=0x0) > at ../../gcc/cp/tree.c:1444 > #18912 0xe4559 in expand_body (fn=0x3e0000, 4063232) > at ../../gcc/cp/semantics.c:2332 > #18913 0xa1c60 in yyparse () at /usr/local/share/bison.simple:2162 > #18914 0x11b41e in compile_file (name=0x7fffc1cd "fcomplex.ii") > at ../../gcc/toplev.c:2361 > #18915 0x120802 in main (argc=4, argv=0x7fffc0c0, 2147467476) > at ../../gcc/toplev.c:4843 > > (gdb) frame 18911 > #18911 0xed91c in walk_tree_without_duplicates (tp=0x3dbb80, > func=0xe40ac , data=0x0) > at ../../gcc/cp/tree.c:1444 > 1444 result = walk_tree (tp, func, data, htab); > (gdb) p debug_tree (*tp) > arg 0 chain arg 0 > > side-effects arg 0 > arg 1 > > side-effects addressable arg 0 > arg 1 > > side-effects > arg 0 > > side-effects used arg 0 > arg 1 >>> > chain >>> > $3 = void > > At frame #5, we have > > (gdb) frame 5 > #5 0xe97ca in walk_tree (tp=0xa52854, > func=0xe40ac , data=0x0, htab=0x308700) > at ../../gcc/cp/tree.c:1251 > 1251 result = (*func) (tp, &walk_subtrees, data); > (gdb) p debug_tree (*tp) > type needs-constructing type_1 type_5 DI > size > unit size > align 32 symtab 0 alias set -1 > fields > private nonlocal decl_3 SF file ../../../libstdc++/std/fcomplex.h line 51 > size > unit size > align 32 offset_align 32 > offset > bit offset context > arguments chain > > needs-constructor X() X(constX&) this=(X&) n_parents 0 use_template=2 vtable-needs-writing > member-functions elt 0 > elt 2 > elt 3 > elt 4 > elt 5 > elt 6 > elt 7 > elt 8 > > pointer_to_this reference_to_this chain >> > side-effects > arg 0 type > unsigned SI size unit size > align 32 symtab 0 alias set -1> > readonly > arg 0 > readonly used public external inline QI file ../../../libstdc++/std/complext.h line 160 > frame_size 0 arguments initial > template-info 003ff0e0 > (mem:QI (symbol_ref:SI ("__pl__H1Zf_RCt7complex1ZX01X01_t7complex1ZX01")) 0)>> > arg 1 value > readonly > arg 0 > readonly arg 0 >> > chain >> > arg 2 > > used DI file ../../../libstdc++/std/fcomplex.h line 60 size unit size > align 32>> > $4 = void > > Debugging this is a real maize. Let me know if anyone has any clues or > suggestions. > Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) 2001-04-13 John David Anglin * semantics.c (simplify_aggr_init_exprs_r): Add DIRECT_BIND to flags in call to build_aggr_init to prevent conversion of CALL_EXPR back to a AGGR_INIT_EXPR. This prevents infinite recursion when PCC_STATIC_STRUCT_RETURN is defined. Save flag_access_control across call to build_aggr_init. --- semantics.c.orig Thu Apr 12 12:35:13 2001 +++ semantics.c Fri Apr 13 21:27:06 2001 @@ -2237,10 +2237,11 @@ #ifdef PCC_STATIC_STRUCT_RETURN if (!AGGR_INIT_VIA_CTOR_P (aggr_init_expr) && aggregate_value_p (type)) { - int old_ac; + int old_ac = flag_access_control; flag_access_control = 0; - call_expr = build_aggr_init (slot, call_expr, LOOKUP_ONLYCONVERTING); + call_expr = build_aggr_init (slot, call_expr, + DIRECT_BIND | LOOKUP_ONLYCONVERTING); flag_access_control = old_ac; copy_from_buffer_p = 1; }