This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/69368] [6 Regression] spec2006 test case 416.gamess fails with the g++ 6.0 compiler starting with r232508
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Feb 2016 10:16:16 +0000
- Subject: [Bug fortran/69368] [6 Regression] spec2006 test case 416.gamess fails with the g++ 6.0 compiler starting with r232508
- Auto-submitted: auto-generated
- References: <bug-69368-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69368
--- Comment #67 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> > How can K(1) and K(2*1) be the same without using undefinedness explicitely?
> They can't, but why does that matter for undefined behavior?
> The CSE code in DOM doesn't try to analyze the array indices at all, it is
> enough for it to prove that in valid program they must be all same.
How can you "prove" that I and 2*I are the same in a valid program?
> Whether the compiler could with additional efforts prove they are different or
> not (it can't e.g. without LTO and without seeing caller that passes two
> different variables).
If you trust
COMMON /BLK/ K(1)
then
FOO = K(I) + K(J) + K(2*I) + K(2*J)
is invalid for any value of I and J: K(I) + K(J) is valid iff I=J=1, then
the access to K(2) is out of bound, hence invalid.