home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19946 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.1 KB  |  38 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!ray
  3. From: ray@netcom.com (Ray Fischer)
  4. Subject: Anyone else seen this MPW C bug?
  5. Message-ID: <1992Dec17.024634.5959@netcom.com>
  6. Organization: Netcom. San Jose, California
  7. Distribution: na
  8. Date: Thu, 17 Dec 1992 02:46:34 GMT
  9. Lines: 27
  10.  
  11. I just came across an incredibly blatant MPW C bug, and I'm having a
  12. hard time believing that it hasn't been fixed yet.  Briefly, if you
  13. multiply a long integer by constant 12 with the mc68020 option on, the
  14. MPW compiler generates the wrong code!  
  15.  
  16. This is with MPW C 3.2; if there is a newer version that fixes the problem
  17. that I haven't heard about, I'd really appreciate someone letting me
  18. know about it.
  19.  
  20. If you want to try it yourself, here's a sample program.
  21. Use the mc68020 option.
  22.  
  23. main() {
  24.   long a,b;
  25.   a = 3000;
  26.   b = a * 12;
  27.   return b;
  28. }
  29.  
  30. The compiler generates an LEA to multiply by 3 (which is good) but
  31. then uses an ASL.W to multiply by 4 (instead of ASL.L)!
  32.  
  33. Help?
  34.  
  35. -- 
  36. Ray Fischer                   "Convictions are more dangerous enemies of truth
  37. ray@netcom.com                 than lies."  -- Friedrich Nietszsche
  38.