https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69368
--- Comment #46 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 18 Feb 2016, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69368 > > --- Comment #45 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > Consider e.g. one source file > INTEGER FOO > COMMON /BLK/ K(64) > DO I=1,64 > K(I)=1 > END DO > IF (FOO(5,12).NE.51) CALL ABORT > END > and another one: > FUNCTION FOO(I, J) > COMMON /BLK/ K(1) > FOO = K(I) + K(J) + K(2*I) + K(2*J) > END FUNCTION > If the second source file is compiled with -O2, it will return "wrong" value, > as if all accesses to K were using the same index (because the only valid > index > is 1). If you compile with -O2 -fno-tree-dominator-opts, then it "works". Which is odd since FRE already should optimize it that way. Richard.