Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

XE 2013 SP1 /O3 optimization bug

$
0
0

The following code snipped is from a DO-loop over the variable I. When I compile with /O3 I get ILA2(I) overwritten with an impossible value JJ (which seem to come from the preceding I-loop), but which is semantically impossible as ISUM==1 thus JJ should also be updated.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                ISUM = 0
                DO J=ILA1(I),ILA2(I)
                        select case (MERKV(IAMA(J)))
                        case (MERKV_PREDEFINED_UNUSED,MERKV_UNDEFINED)
                            ISUM= ISUM+1
                            IV  = IAMA(J)
                            JJ  = J
                        end select
                ENDDO
                IF (ISUM .EQ. 1) THEN
                    MERKG(I) = MERKG_USED
                    ILAUF=ILAUF+1
                    
                    select case (MERKV(IV))
                    case (MERKV_UNDEFINED)
                        MERKV(IV) = MERKV_DEFINED

                    case (MERKV_PREDEFINED_UNUSED)
                        MERKV(IV) = MERKV_PREDEFINED_USED
                    end select
                    
                    ILA2(I) = JJ                                    <<<<<<<<<<----------------------- overwrite happens here
                    NREIH = NREIH+1
                    IREIH(NREIH) = I
                    
                  IF(K .LE. 3) THEN
                    CALL SIMCONV_ADDVARDEF( I, IV )
                  ENDIF
                ENDIF

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If I replace

                        select case (MERKV(IAMA(J)))
                        case (MERKV_PREDEFINED_UNUSED,MERKV_UNDEFINED)
                            ISUM= ISUM+1
                            IV  = IAMA(J)
                            JJ  = J
                        end select

from the first DO-loop by

                        if (MERKV(IAMA(J)) .le. MERKV_UNDEFINED) then

                            ISUM= ISUM+1
                            IV  = IAMA(J)
                            JJ  = J
                        end if

which in the program-logic is semantically equivalent then /O3 does not result in errornous code.

regards

Tobias


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>