[gnu.gcc.bug] gcc -O bug under NeXT 1.0 compiling rn PL 40

eps@toaster.SFSU.EDU (Eric P. Scott) (12/16/89)

I'm copying this here "for the record" at the request of a
comp.sys.next reader.  The problem occurs with the gcc
distributed with NeXT Software Release 1.0.  No applicability to
the current FSF version is inferred.

					-=EPS=-
-------
From: eps@toaster.SFSU.EDU (Eric P. Scott)
Newsgroups: comp.sys.next
Subject: % interp buffer overflow when compiling rn PL 40 under 1.0 a gcc bug
Summary: Compile intrp.c separately with  cc -c -bsd (no -O)
Message-ID: <192@toaster.SFSU.EDU>
Date: 15 Dec 89 14:45:52 GMT
Reply-To: eps@cs.SFSU.EDU (Eric P. Scott)
Organization: San Francisco State University
Lines: 27

When this machine was upgraded from 0.9 to 1.0 we recompiled all
the local software.  rn patchlevel 40 started generating
"% interp buffer overflow!" aborts when attempting to follow up
to articles.  The problem has been traced to the gcc optimizer:

*** intrp.c	Fri Nov 21 14:26:45 1986

  834		    i = metabit;		/* maybe get into register */
  835		    if (s == dest) {
  836			while (*dest) {
  837			    if (--destsize <= 0)
  838				abort_interp();
  839			    *dest++ |= i;
                                 ^^ this increment lost in optimization
  840			}
  841		    }
  842		    else {
  843			while (*s) {
  844			    if (--destsize <= 0)
  845				abort_interp();
  846			    *dest++ = *s++ | i;
  847			}
  848		    }

Compiling intrp.c without -O "works" ok.

					-=EPS=-