🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #2191

Gnugrep on Sun 4 - compiler bug & work-round

#2191
From: Ian Phillipps
Date: Mon, 24 Apr 1989 16:28
76 lines
2147 bytes
The recently-posted GNU grep fails Spencer test 36, when compiled with "-O"
on sparc/Sunos4.0.1.  "-O1" was ok.
As the compiler was having trouble with an area with lots of FETCH macro
calls, I placed the following patch, which gets round the bug.


*** dfa.c.orig	Tue Feb 21 15:03:28 1989
--- dfa.c	Mon Apr 24 17:00:47 1989
***************
*** 299,304 ****
--- 299,305 ----
  static _token
  lex()
  {
+   static char E_BAD_PAREN[] = "Unbalanced [";
    _token c, c2;
    int invert;
    _charset cset;
***************
*** 460,469 ****
  
      case '[':
        zeroset(cset);
!       FETCH(c, "Unbalanced [");
        if (c == '^')
  	{
! 	  FETCH(c, "Unbalanced [");
  	  invert = 1;
  	}
        else
--- 461,470 ----
  
      case '[':
        zeroset(cset);
!       FETCH(c, E_BAD_PAREN);
        if (c == '^')
  	{
! 	  FETCH(c, E_BAD_PAREN);
  	  invert = 1;
  	}
        else
***************
*** 470,482 ****
  	invert = 0;
        do
  	{
! 	  FETCH(c2, "Unbalanced [");
  	  if (c2 == '-')
  	    {
! 	      FETCH(c2, "Unbalanced [");
  	      while (c <= c2)
  		  setbit(c++, cset);
! 	      FETCH(c, "Unbalanced [");
  	    }
  	  else
  	    {
--- 471,483 ----
  	invert = 0;
        do
  	{
! 	  FETCH(c2, E_BAD_PAREN);
  	  if (c2 == '-')
  	    {
! 	      FETCH(c2, E_BAD_PAREN);
  	      while (c <= c2)
  		  setbit(c++, cset);
! 	      FETCH(c, E_BAD_PAREN);
  	    }
  	  else
  	    {
****************
[End of patch]
-- 
UUCP:  igp@camcon.co.uk   | Cambridge Consultants Ltd  |  Ian Phillipps
or:    igp@camcon.uucp    | Science Park, Milton Road  |-----------------
Phone: +44 223 420024     | Cambridge CB4 4DW, England |
Technical Details
Message-ID: <2804@titan.camcon.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!stc!idec!camcon!igp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!stc!idec!camcon!igp
From: igp@camcon.co.uk (Ian Phillipps)
Newsgroups: comp.sources.bugs
Subject: Gnugrep on Sun 4 - compiler bug & work-round
Keywords: gnugrep sparc compiler
Message-ID: <2804@titan.camcon.co.uk>
Date: 24 Apr 89 16:28:41 GMT
Organization: Cambridge Consultants Ltd., Cambridge, UK
Lines: 76