[gnu.gcc.bug] Bug in GCC 1.35 compiler driver with -pipe option

ballou@vmsdev.dec.com (Kenneth R. Ballou) (09/07/89)

I did a completely "vanilla" build of GCC 1.35 under ULTRIX 3.1 (that
is, I didn't change the Makefile, and I followed exactly the directions
to make stage1, stage2, and "post stage2", followed by "install").

When I try to use the -pipe option, GCC dumps core after the first
actions are done.  For example, the command line "gcc -v -pipe -c foo.c
bar.c" causes foo.c to be compiled and then gcc to dump core.  Also,
"gcc -pipe foo.c" causes foo.c to be compiled to foo.o, and then gcc
will dump core before invoking the linker.
The core dump shows gcc is in malloc() at the time of the dump.  Also,
using the GNU malloc causes a core dump in malloc with SIGILL.

However, everything works fine if I use the -B flag with a valid
pathname.  For example, if I'm in the directory in which I built gcc and
I do "gcc -pipe -c -Bstage2/ foo.c bar.c", both foo.c and bar.c are compiled.

meissner@DG-RTP.DG.COM (Michael Meissner) (09/07/89)

In article <1444@hiatus.dec.com> you write:
| I did a completely "vanilla" build of GCC 1.35 under ULTRIX 3.1 (that
| is, I didn't change the Makefile, and I followed exactly the directions
| to make stage1, stage2, and "post stage2", followed by "install").
| 
| When I try to use the -pipe option, GCC dumps core after the first
| actions are done.  For example, the command line "gcc -v -pipe -c foo.c
| bar.c" causes foo.c to be compiled and then gcc to dump core.  Also,
| "gcc -pipe foo.c" causes foo.c to be compiled to foo.o, and then gcc
| will dump core before invoking the linker.
| The core dump shows gcc is in malloc() at the time of the dump.  Also,
| using the GNU malloc causes a core dump in malloc with SIGILL.
| 
| However, everything works fine if I use the -B flag with a valid
| pathname.  For example, if I'm in the directory in which I built gcc and
| I do "gcc -pipe -c -Bstage2/ foo.c bar.c", both foo.c and bar.c are compiled.
| 

I found this some time ago.  The problem is gcc.c is writing outside
the bounds of allocated memory in this case.  It appears to be fixed
in the alpha releases of 1.36.  Here is a patch, though your line
numbers will probably differ:

diff -c gcc-1.35.00/gcc.c gcc-1.35/gcc.c
*** gcc-1.35.00/gcc.c	Wed Aug 16 14:12:38 1989
--- gcc-1.35/gcc.c	Wed Aug 30 16:17:01 1989
***************
*** 536,542 ****
    if (!win)
      {
        strcpy (temp, standard_exec_prefix_1);
!       strcat (temp, argbuf[0]);
        win = (access (temp, X_OK) == 0);
      }
  
--- 585,591 ----
    if (!win)
      {
        strcpy (temp, standard_exec_prefix_1);
!       strcat (temp, prog);
        win = (access (temp, X_OK) == 0);
      }
  
--
Michael Meissner, Data General.
Uucp:		...!mcnc!rti!xyzzy!meissner		If compiles were much
Internet:	meissner@dg-rtp.DG.COM			faster, when would we
Old Internet:	meissner%dg-rtp.DG.COM@relay.cs.net	have time for netnews?