Bootstrap error on x86-linux, fixincl segfault + fix

Bruce Korb bkorb@sco.COM
Thu May 11 12:01:00 GMT 2000


"Kaveh R. Ghazi" wrote:
> 
> I'm getting a segfault from stage1 fixincl today.
> 
>  > ./fixincl -v
>  > make[3]: *** [install-bin] Segmentation fault (core dumped)
> 
> Here is the backtrace from gdb:
> 
>  > (gdb) where
>  > #0  0x8049a47 in run_compiles ()
>  >     at ../../../egcs-CVS20000511/gcc/fixinc/fixincl.c:408
>  > #1  0x80494c6 in do_version ()
>  >     at ../../../egcs-CVS20000511/gcc/fixinc/fixincl.c:192
>  > #2  0x8049566 in initialize (argc=2, argv=0xbfffedc4)
>  >     at ../../../egcs-CVS20000511/gcc/fixinc/fixincl.c:216
>  > #3  0x8049333 in main (argc=2, argv=0xbfffedc4)
>  >     at ../../../egcs-CVS20000511/gcc/fixinc/fixincl.c:111
>  > (gdb) p pz_machine
>  > $1 = 0x0
> 
> The following patch seemed to fix it.  But its only the correct
> approach if pz_machine is allowed to be null at this point.  If not,
> then the bug lies elsewhere.
> 
>                 --Kaveh
> 
> diff -rup orig/egcs-CVS20000511/gcc/fixinc/fixincl.c egcs-CVS20000511/gcc/fixinc/fixincl.c
> --- orig/egcs-CVS20000511/gcc/fixinc/fixincl.c  Thu May 11 10:00:57 2000
> +++ egcs-CVS20000511/gcc/fixinc/fixincl.c       Thu May 11 07:59:59 2000
> @@ -405,7 +405,7 @@ run_compiles ()
> 
>    /*  Allow machine name tests to be ignored (testing, mainly) */
> 
> -  if ((*pz_machine == '\0') || (*pz_machine == '*'))
> +  if (pz_machine && ((*pz_machine == '\0') || (*pz_machine == '*')))
>      pz_machine = (char*)NULL;
> 
>    /* FOR every fixup, ...  */


Exactly right.  My mistake, but there is also little point in
assigning it NULL if it is already NULL :-).  Please apply as
I am off to other things for a while.  Cheers!


More information about the Gcc-bugs mailing list