🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2316

gcc 1.33 aborts in final()...

#2316
From: Ted Lemon
Date: Fri, 17 Feb 1989 00:22
81 lines
3067 bytes
When I compile a certain test program with all optimizations enabled,
cc1 dies of a SIGIOT signal, because final() calls abort().   Two
examples of programs that exhibit this bug follow - the first one is
actually incorrect C code because the variable i is used before it is
initialized, but the second file is correct, because i is initialized.
The third program which follows is a version of gcctest.c in which i
is initialized.   It does not exhibit the bug.

I'm trying to trace this bug back to its origins myself, but I haven't
been getting very far - this is my first time looking at the optimizer
- so if someone fixes it, I'd appreciate hearing what the problem was.
Thanx!

			       _MelloN_


------------------------------gcctest.c-----------------------------
int brick[20 ];
int hand;
int isnum(), num();

void fred_villari (u2)
{
  int i;

  if ((brick [hand] - i) < 0)
      brick [hand] = 0;
}
--------------------------------------------------------------------

------------------------------gcctesti.c----------------------------
int brick[20 ];
int hand;
int isnum(), num();

void fred_villari (u2)
{
  int i;

  if (u2 == -1)
    i = 1;
  else {
    if (!isnum (u2))
      return;
    i = num (u2);
  }

  if ((brick [hand] - i) < 0)
      brick [hand] = 0;
}
--------------------------------------------------------------------

------------------------------gcctestn.c----------------------------
int brick[20 ];
int hand;
int isnum(), num();

void fred_villari (u2)
{
  int i = u2;

  if ((brick [hand] - i) < 0)
      brick [hand] = 0;
}
--------------------------------------------------------------------

The command I used to evoke this problem, and the output, are shown
below:

slypnir% cc1 gcctestn.c -quiet gcctestn.c -fstrength-reduce -fcombine-regs -fforce-mem -fforce-addr -finline-functions -fwritable-strings -O -Wall -version -o gcctestn.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
slypnir% cc1 gcctesti.c -quiet gcctesti.c -fstrength-reduce -fcombine-regs -fforce-mem -fforce-addr -finline-functions -fwritable-strings -O -Wall -version -o gcctesti.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
IOT trap (core dumped)
slypnir% cc1 gcctest.c -quiet gcctest.c -fstrength-reduce -fcombine-regs -fforce-mem -fforce-addr -finline-functions -fwritable-strings -O -Wall -version -o gcctest.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
gcctest.c: In function fred_villari:
gcctest.c:7: warning: variable `i' used uninitialized in this function
IOT trap (core dumped)
slypnir% 
Technical Details
Message-ID: <8902170022.AA04732@slypnir>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!TIS.LLNL.GOV!capmkt!nlp3!mellon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!TIS.LLNL.GOV!capmkt!nlp3!mellon
From: capmkt!nlp3!mellon@TIS.LLNL.GOV (Ted Lemon)
Newsgroups: gnu.gcc.bug
Subject: gcc 1.33 aborts in final()...
Message-ID: <8902170022.AA04732@slypnir>
Date: 17 Feb 89 00:22:30 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 81