[Bug translation/24039] cpp segfaults when a non-existent include is encountered

heas at shrubbery dot net gcc-bugzilla@gcc.gnu.org
Thu Sep 29 19:43:00 GMT 2005


------- 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 -0000, 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 -0000, 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.

0x00000001006040c8 <libintl_dcigettext+3248>:   mov  %g1, %i0
0x00000001006040cc <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:
	...
0x0000000100606a3c <libintl_dcgettext+52>:      call  0x100603418 <libintl_dcigettext>
0x0000000100606a40 <libintl_dcgettext+56>:      nop 
0x0000000100606a44 <libintl_dcgettext+60>:      mov  %o0, %g1
0x0000000100606a48 <libintl_dcgettext+64>:      mov  %g1, %i0
0x0000000100606a4c <libintl_dcgettext+68>:      rett  %i7 + 8
0x0000000100606a50 <libintl_dcgettext+72>:      nop 

g1             0x1006bd2c8      4302033608
o0             0x1006bd2c8      4302033608
i0             0x1006bd2c8      4302033608

from:
Dump of assembler code for function libintl_dgettext:
	...
0x00000001005ff378 <libintl_dgettext+24>:       call  0x100606a08 <libintl_dcgettext>
0x00000001005ff37c <libintl_dgettext+28>:       nop 
0x00000001005ff380 <libintl_dgettext+32>:       mov  %o0, %g1
0x00000001005ff384 <libintl_dgettext+36>:       sra  %g1, 0, %g1
0x00000001005ff388 <libintl_dgettext+40>:       mov  %g1, %i0
0x00000001005ff38c <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



More information about the Gcc-bugs mailing list