http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54767
Bug #: 54767
Summary: Incorrect code generated with "-O2 -fcheck=bounds"
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Using the code attached:
>gfortran --version | head -2
GNU Fortran (GCC) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
>gfortran -O0 -fcheck=bounds xxx_1.f xxx_2.f
>/a.out
2 1
3 2
T
>gfortran -O2 -fcheck=bounds xxx_1.f xxx_2.f
>./a.out
2 1
3 1
F
The results are different and incorrect when compiling with "-O2
-fcheck=bounds". They are still correct when compiling with "-O1
-fcheck=bounds".