------- Additional Comments From heas at shrubbery dot net 2005-09-23 21:23 ------- Subject: Re: cpp segfaults when a non-existent include is encountered
Fri, Sep 23, 2005 at 08:02:17PM -0000, pinskia at gcc dot gnu dot org: > -dH but there is a better way to get a backtrace. > use > gdb --args /usr/local/libexec/gcc/sparc64-sun-solaris2.9/4.1.0/cc1 -E -quiet > -v -D__arch64__ > -D__sparcv9 test.c -mcpu=v9 -mtune=ultrasparc -fpch-preprocess -o test.i > nice. here is the trace: #0 0xffffffff7f23d28c in strlen () from /usr/lib/64/libc.so.1 #1 0xffffffff7f29c318 in fputs () from /usr/lib/64/libc.so.1 #2 0x00000001005ed5f4 in _cpp_begin_message (pfile=Variable "pfile" is not available. ) at ../../gcc-4.1-20050917/libcpp/errors.c:120 #3 0x00000001005ed8c8 in cpp_error (pfile=0x1, level=3, msgid=0x1006b71e0 "%s: %s") at ../../gcc-4.1-20050917/libcpp/errors.c:155 #4 0x00000001005f2184 in _cpp_find_file (pfile=0x100903300, fname=0x100907010 "segfault.h", start_dir=0x1008d1890, fake=28 '\034') at ../../gcc-4.1-20050917/libcpp/files.c:436 #5 0x00000001005f2e60 in _cpp_stack_include (pfile=0x100903300, fname=0x100907010 "segfault.h", angle_brackets=1, type=IT_INCLUDE) at ../../gcc-4.1-20050917/libcpp/files.c:820 #6 0x00000001005eaf70 in do_include_common (pfile=0x100903300, type=IT_INCLUDE) at ../../gcc-4.1-20050917/libcpp/directives.c:695 I stepped through it, and it appears to be failing with a gettext call. not the exact location: (gdb) whe #0 libintl_dcigettext (domainname=0x1006b71a0 "cpplib", msgid1=0x1006b71d0 "error: ", msgid2=0x0, plural=0, n=0, category=5) at ../../gcc-4.1-20050917/intl/dcigettext.c:579 #1 0x00000001005ff234 in libintl_dgettext (domainname=0x1006b71a0 "cpplib", msgid=0x1006b71d0 "error: ") at ../../gcc-4.1-20050917/intl/dgettext.c:53 #2 0x00000001005ed5dc in _cpp_begin_message (pfile=Variable "pfile" is not available. ) at ../../gcc-4.1-20050917/libcpp/errors.c:120 ... (gdb) libintl_dgettext (domainname=0x1006b71a0 "cpplib", msgid=0x1006b71d0 "error: ") at ../../gcc-4.1-20050917/intl/dgettext.c:54 54 } (gdb) _cpp_begin_message (pfile=Variable "pfile" is not available. ) at ../../gcc-4.1-20050917/libcpp/errors.c:125 125 } (gdb) 120 fputs (_("internal error: "), stderr); (gdb) Program received signal SIGSEGV, Segmentation fault. 0xffffffff7f23d28c in strlen () from /usr/lib/64/libc.so.1 if I set the environment variable LANG to "C" (previously unset), it works: sparc% setenv LANG C sparc% gcc -E -dH test.c > test.i gcc: test.c: No such file or directory gcc: no input files -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039