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