home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / gcc / bug / 2238 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.6 KB  |  44 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!kryton.UUCP!system
  3. From: system@kryton.UUCP (Scott Beckstead)
  4. Subject: Bug in cygnus 2.0.1 (2.1 and 2.2.2 of mainstream)
  5. Message-ID: <X3NgqB3w164w@kryton.UUCP>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Paradox Alley F&SF BBS 805-492-8789
  8. Distribution: gnu
  9. Date: Wed, 2 Sep 1992 06:33:44 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 31
  12.  
  13. I am currently porting a cygnus version of gcc (gpp objc etc.) to a new system.
  14. In my libraries (ansi) strcmp return -1 for less than, 1 for greater than and
  15. 0 for equality.  The spec merely states negative for less than positive for greater
  16. than and 0 for equal.  Yet in the file rtl.c There is a code fragment that 
  17. looks like this 
  18.  
  19.     if(!strcmp(somevalue,someothervalue))
  20.         someaction;
  21.  
  22. This seems like a particularly BAD idea considering the values returned by
  23. this fully ansi compliant library (yes it does change the behavior of
  24. the programs)  I have modified my library to fix this but the code
  25. really should be fixed so that a unary not of a non boolean return
  26. is not used as a boolean.  Because with the value -1 I'm sure you see the
  27. problem.  (!(-1) is 0 but !(1) is -2 and !(0) is -1) 
  28.  
  29. I beleive the intent of this code to be:
  30.  
  31.      if(!(strcmp(somevalue,someothervalue) == 0))
  32.              someaction;  
  33.  
  34. the function name is read_rtx()
  35.  
  36. If there is some other purpose to this code it is undocumented and unclear
  37. what it might be.  I am unwilling to make the code change because I do not
  38. fully understand what is happening here. It is quicker for me to modify 
  39. the library functions (without degrading ansi compliance) because I KNOW
  40. what their intent is.
  41. Scott
  42.  
  43.  
  44.