[Bug translation/24039] cpp segfaults when a non-existent include is encountered
--- Additional Comments From heas at shrubbery dot net 2005-09-29 19:43 --- Subject: Re: cpp segfaults when a non-existent include is encountered Fri, Sep 23, 2005 at 10:18:27PM -, heas at shrubbery dot net: --- Additional Comments From heas at shrubbery dot net 2005-09-23 22:18 --- Subject: Re: cpp segfaults when a non-existent include is encountered Fri, Sep 23, 2005 at 10:10:12PM -, pinskia at gcc dot gnu dot org: Hmm, I still cannot reproduce this with LANG set to nothing. I think that I mis-spoke in my excitment; it still fails with LANG set. In the example that I sent, I was in the wrong directory, where test.c did not exist. sorry. I will poke some more. ok; following this through... We come here: char * DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) return (plural == 0 ? (char *) msgid1 /* Use the Germanic plural rule. */ : n == 1 ? (char *) msgid1 : (char *) msgid2); } end-up at the end, with plural == 0 msgid1 pointing to the untranslated string that was passed in and the return is set-up properly. 0x0001006040c8 libintl_dcigettext+3248: mov %g1, %i0 0x0001006040cc libintl_dcigettext+3252: rett %i7 + 8 i0 0x1006bd2c8 4302033608 (gdb) p (char*) 0x1006bd2c8 $22 = 0x1006bd2c8 error: and that is called from: Dump of assembler code for function libintl_dcgettext: ... 0x000100606a3c libintl_dcgettext+52: call 0x100603418 libintl_dcigettext 0x000100606a40 libintl_dcgettext+56: nop 0x000100606a44 libintl_dcgettext+60: mov %o0, %g1 0x000100606a48 libintl_dcgettext+64: mov %g1, %i0 0x000100606a4c libintl_dcgettext+68: rett %i7 + 8 0x000100606a50 libintl_dcgettext+72: nop g1 0x1006bd2c8 4302033608 o0 0x1006bd2c8 4302033608 i0 0x1006bd2c8 4302033608 from: Dump of assembler code for function libintl_dgettext: ... 0x0001005ff378 libintl_dgettext+24: call 0x100606a08 libintl_dcgettext 0x0001005ff37c libintl_dgettext+28: nop 0x0001005ff380 libintl_dgettext+32: mov %o0, %g1 0x0001005ff384 libintl_dgettext+36: sra %g1, 0, %g1 0x0001005ff388 libintl_dgettext+40: mov %g1, %i0 0x0001005ff38c libintl_dgettext+44: rett %i7 + 8 there's the problem. that sra instruction mashes the pointer: o0 0x1006bd2c8 4302033608 g1 0x6bd2c8 7066312 which ends-up in the caller's register set: o0 0x6bd2c8 7066312 at the least, that should be a srax inst., i think. If i fix %o0 here, before fputs is called, it continues until the next call to _cpp_begin_message(). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039
[Bug translation/24039] cpp segfaults when a non-existent include is encountered
--- Additional Comments From heas at shrubbery dot net 2005-09-29 20:07 --- Subject: Re: cpp segfaults when a non-existent include is encountered dgettext.c thinks that libintl_dcgettext returns an int. Which I do not understand, since it includes libintl.h which has: # 163 ./libintl.h 3 4 extern char *dcgettext (const char *__domainname, const char *__msgid, int __category) __asm__ ( libintl_dcgettext); but, I do not understand the __asm__ macro. after hacking dgettext.c w/ a prototype, cc1 no longer cores and doesnt have the sra instruction anymore. and, gcc does complain about the virgin file: gcc -c -g -O0 -DHAVE_CONFIG_H -I. -I../../gcc-4.1-20050917/intl ../../gcc-4.1-20050917/intl/dgettext.c ../../gcc-4.1-20050917/intl/dgettext.c: In function 'libintl_dgettext': ../../gcc-4.1-20050917/intl/dgettext.c:53: warning: return makes pointer from integer without a cast -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039
[Bug preprocessor/24039] New: cpp segfaults when a non-existent include is encountered
Target: sparc64-sun-solaris2.9 Configured with: ../gcc-4.1-20050917/configure --enable-threads --enable-multilib --with-cpu=v9 --with-tune=ultrasparc sparc64-sun-solaris2.9 --enable-languages=c,c++ Thread model: posix gcc version 4.1.0 20050917 (experimental) sparc% /usr/local/bin/cpp test.c # 1 test.c # 0 built-in # 1 command line # 1 test.c test.c:1:22: built-in:0: internal compiler error: Segmentation Fault sparc% cat test.c #include segfault.h sparc% more test.i # 1 test.c # 0 built-in # 1 command line # 1 test.c -- Summary: cpp segfaults when a non-existent include is encountered Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: heas at shrubbery dot net CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: sparc64-sun-solaris2.9 GCC host triplet: sparc64-sun-solaris2.9 GCC target triplet: sparc64-sun-solaris2.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039
[Bug preprocessor/24039] cpp segfaults when a non-existent include is encountered
--- Additional Comments From heas at shrubbery dot net 2005-09-23 19:57 --- Subject: Re: cpp segfaults when a non-existent include is encountered Fri, Sep 23, 2005 at 07:45:59PM -, pinskia at gcc dot gnu dot org: Can you add -v and give the output? Sure. sparc% gcc-bin -v -save-temps -c test.c Using built-in specs. Target: sparc64-sun-solaris2.9 Configured with: ../gcc-4.1-20050917/configure --enable-threads --enable-multilib --with-cpu=v9 --with-tune=ultrasparc sparc64-sun-solaris2.9 --enable-languages=c,c++ Thread model: posix gcc version 4.1.0 20050917 (experimental) /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 ignoring nonexistent directory NONE/include ignoring nonexistent directory /usr/local/lib/gcc/sparc64-sun-solaris2.9/4.1.0/../../../../sparc64-sun-solaris2.9/include #include ... search starts here: #include ... search starts here: /usr/local/include /usr/local/lib/gcc/sparc64-sun-solaris2.9/4.1.0/include /usr/include End of search list. test.c:1:22: built-in:0: internal compiler error: Segmentation Fault Please submit a full bug report, with preprocessed source if appropriate. See URL:http://gcc.gnu.org/bugs.html for instructions. How do I make it dump a core instead of catching the signal? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039
[Bug preprocessor/24039] cpp segfaults when a non-existent include is encountered
--- 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 -, 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 0x7f23d28c in strlen () from /usr/lib/64/libc.so.1 #1 0x7f29c318 in fputs () from /usr/lib/64/libc.so.1 #2 0x0001005ed5f4 in _cpp_begin_message (pfile=Variable pfile is not available. ) at ../../gcc-4.1-20050917/libcpp/errors.c:120 #3 0x0001005ed8c8 in cpp_error (pfile=0x1, level=3, msgid=0x1006b71e0 %s: %s) at ../../gcc-4.1-20050917/libcpp/errors.c:155 #4 0x0001005f2184 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 0x0001005f2e60 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 0x0001005eaf70 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 0x0001005ff234 in libintl_dgettext (domainname=0x1006b71a0 cpplib, msgid=0x1006b71d0 error: ) at ../../gcc-4.1-20050917/intl/dgettext.c:53 #2 0x0001005ed5dc 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. 0x7f23d28c 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
[Bug translation/24039] cpp segfaults when a non-existent include is encountered
--- Additional Comments From heas at shrubbery dot net 2005-09-23 21:56 --- Subject: Re: cpp segfaults when a non-existent include is encountered Fri, Sep 23, 2005 at 09:53:33PM -, pinskia at gcc dot gnu dot org: --- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-23 21:53 --- Can you give the output of env before setting LANG? USER=root LOGNAME=root HOME=/home/heas PATH=/usr/pkg/bin:/usr/pkg/sbin:/home/heas/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/sbin:/usr/openwin/bin:/usr/ucb MAIL=/var/mail//heas SHELL=/bin/tcsh TZ=UTC SSH_CLIENT=198.58.5.2 64591 22 SSH_CONNECTION=198.58.5.2 64591 198.58.5.71 22 SSH_TTY=/dev/pts/3 TERM=xterm DISPLAY=localhost:12.0 HOSTTYPE=sun4 VENDOR=sun OSTYPE=solaris MACHTYPE=sparc SHLVL=2 PWD=/home/pkgsrc GROUP=root HOST=yew REMOTEHOST=maple.shrubbery.net UNAME=/bin/uname CVSROOT=/home/heas/.CVS CVS_RSH=ssh RSYNC_RSH=ssh CLOGIN=x TMPDIR=/tmp PRINTER=lp PAGER=less MANPATH=/usr/pkg/man:/home/ops/man:/usr/local/man:/usr/man:/usr/local/X11/man:/usr/local/gnu/man EDITOR=/usr/ucb/vi VISUAL=/usr/ucb/vi PGPPATH=/home/heas/.pgp SUDO_COMMAND=/usr/pkg/bin/tcsh SUDO_USER=heas SUDO_UID=7053 SUDO_GID=0 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039
[Bug translation/24039] cpp segfaults when a non-existent include is encountered
--- Additional Comments From heas at shrubbery dot net 2005-09-23 22:18 --- Subject: Re: cpp segfaults when a non-existent include is encountered Fri, Sep 23, 2005 at 10:10:12PM -, pinskia at gcc dot gnu dot org: Hmm, I still cannot reproduce this with LANG set to nothing. I think that I mis-spoke in my excitment; it still fails with LANG set. In the example that I sent, I was in the wrong directory, where test.c did not exist. sorry. I will poke some more. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24039