🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1044

Bug in cygnus 2.0.1 (2.1 and 2.2.2 of mainstream)

#1044
From: Scott Beckstead
Date: Wed, 02 Sep 1992 06:33
29 lines
1714 bytes
I am currently porting a cygnus version of gcc (gpp objc etc.) to a new system.
In my libraries (ansi) strcmp return -1 for less than, 1 for greater than and
0 for equality.  The spec merely states negative for less than positive for greater
than and 0 for equal.  Yet in the file rtl.c There is a code fragment that 
looks like this 

	if(!strcmp(somevalue,someothervalue))
		someaction;

This seems like a particularly BAD idea considering the values returned by
this fully ansi compliant library (yes it does change the behavior of
the programs)  I have modified my library to fix this but the code
really should be fixed so that a unary not of a non boolean return
is not used as a boolean.  Because with the value -1 I'm sure you see the
problem.  (!(-1) is 0 but !(1) is -2 and !(0) is -1) 

I beleive the intent of this code to be:

     if(!(strcmp(somevalue,someothervalue) == 0))
             someaction;  

the function name is read_rtx()

If there is some other purpose to this code it is undocumented and unclear
what it might be.  I am unwilling to make the code change because I do not
fully understand what is happening here. It is quicker for me to modify 
the library functions (without degrading ansi compliance) because I KNOW
what their intent is.
Scott
Technical Details
Message-ID: <X3NgqB3w164w@kryton.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kryton.UUCP!system

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kryton.UUCP!system
From: system@kryton.UUCP (Scott Beckstead)
Subject: Bug in cygnus 2.0.1 (2.1 and 2.2.2 of mainstream)
Message-ID: <X3NgqB3w164w@kryton.UUCP>
Sender: gnulists@ai.mit.edu
Organization: Paradox Alley F&SF BBS 805-492-8789
Distribution: gnu
Date: Wed, 2 Sep 1992 06:33:44 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 31