home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4397 < prev    next >
Encoding:
Text File  |  1992-11-21  |  2.1 KB  |  42 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!alf.uib.no!dsfys1.fi.uib.no!iversen
  3. From: iversen@dsfys1.fi.uib.no (Per Steinar Iversen)
  4. Subject: Legal optimization?
  5. Message-ID: <1992Nov21.114131.24902@alf.uib.no>
  6. Lines: 29
  7. Sender: iversen@vsfys1.fi.uib.no (Per Steinar Iversen)
  8. Reply-To: iversen@vsfys1.fi.uib.no
  9. Organization: Department of Physics, University of Bergen, Norway
  10. Date: Sat, 21 Nov 92 11:41:31 GMT
  11. Lines: 29
  12.  
  13.  
  14.  
  15. One of the students here uses VAX FORTRAN to calculate various things for his
  16. thesis. Recently he had some problems, which were traced down to a real bug.
  17. However: A result of the bug was that a square root of a negative REAL occurred.
  18. Yet this never made the program crash! When either a WRITE statement was 
  19. inserted on the next line after the SQRT or the optimization was turned off,
  20. then the program crashed properly... Presumably the optimizer transforms the
  21. code into something which is OK if the values are *not* negative. At least in 
  22. this program however the results were just garbage if the negative root occurred.
  23.  
  24. The compiler is VAX FORTRAN V5.8-155 under VMS 5.5. So far I always felt safe
  25. if my programs compiled and ran with 
  26. FORTRAN/CHECK=ALL/STANDARD=ALL/WARNING=(GENERAL,DECLARATIONS), but I guess I
  27. should add /NOOPTIMIZE too.
  28.  
  29. My question is more philosophical perhaps: Are such transformations of the 
  30. code actually legal, is the compiler performing within the standard?
  31.  
  32. -psi
  33.  
  34. +------------------------------------------------------------------------------+
  35. ! Per Steinar Iversen    ! Internet:     iversen@vsfys1.fi.uib.no              !
  36. ! Fysisk Institutt       ! BITnet:       iversen@cernvm.bitnet                 !
  37. ! Universitetet i Bergen ! HEPnet:       VSFYS::IVERSEN (VSFYS=21.341=21845)   !
  38. ! Allegaten 55           ! Phone:       +47 5212770                            !
  39. ! N-5007 Bergen          ! Fax:         +47 5318334                            !
  40. ! NORWAY                 !                                                     !
  41. +------------------------------------------------------------------------------+
  42.