more IRIX 3.3.1 f77 -O2 bugs

Glenn Randers-Pehrson, TBD|WMB glennrp at BRL.MIL
Tue Jan 15 03:52:55 AEST 1991


I have encountered several more bugs with the IRIX 3.3.1 f77 compiler
when used with -O2.  These are worse than the one I reported last week,
in that the compiler silently produces bogus code, instead of the core
dump.  I'll provide sources to anyone who is interested.

One class of statements causing problems involves the INQUIRE statement,
where the same logical variable appears in several INQUIRE statements,
as "isopen" in
        inquire(8,opened=isopen)
        if(isopen)....
        inquire(9,opened=isopen)
        if(isopen)...
The optimizer apparently does not recognize that the INQUIRE statement
assigns a new value to "isopen".

Another seems to involve an assumption by the programmer about storage
association, that the optimizer apparently did not recognize:

        subroutine sub(array))
        dimension array(6)
        common /a/ j,r(5)
        do 10 i=1,6
   10   r(i-1)=array(i)

The loop is supposed to copy the contents of the first element of "array"
into "j", without doing a float-to-integer conversion.  In the code, "j"
does get properly defined, but the optimizer gets goofed up later on in
the program, with entirely different variables.  When I rewrote this coding
to be a little more explicit, but still horrible to look at, then the problem
went away.

        subroutine sub(array))
        dimension array(6)
        common /a/ j,r(5)
        equivalence (rj,j)
        rj=array(1)
        do 10 i=2,5
   10   r(i-1)=array(i)

...Glenn Randers-Pehrson <glennrp at brl.mil>



More information about the Comp.sys.sgi mailing list