[Bug fortran/51267] loop optimization error using LOC function

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 22 15:48:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51267

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2011-11-22 15:40:43 UTC ---
(In reply to comment #0)
> Created attachment 25880 [details]
> simple source file
> 
> The small program attached fails using gfortran 4.6.1 (ubuntu oneiric built)
> using -O1 optimization level or higher (ok at -O0).
> It succeeds with gfortran 4.5.4 at all -O levels.
> 
> It ends by printing a boolean value : T if the test is ok, F else.
> 
> $ gfortran-4.5 -O1 -Wall -Wextra bug46_stat.f ; ./a.out
>  tab(           1 )=          -1
>  tab(           2 )=          -1
>  tab(           3 )=          -1
>  tab(           4 )=          -1
>  tab(           5 )=          -1
>  tab(           6 )=          -1
>  T
> 
> $ gfortran-4.6 -O1 -Wall -Wextra bug46_stat.f ; ./a.out
>  tab(           1 )=   134520832
>  tab(           2 )=    10813028
>  tab(           3 )=          -1
>  tab(           4 )=           0
>  tab(           5 )=    10870894
>  tab(           6 )=          -1
>  F
> 
> 
> Ouput with '-v' : 

Have you considered compiling the code with -fcheck=all?
It shows that you have an array reference issue.

troutmask:sgk[206] gfc4x -o z -fcheck=all -O bug46_stat.f
troutmask:sgk[207] ./z
At line 10 of file bug46_stat.f
Fortran runtime error: Index '-7' of dimension 1 of array 'ius' below lower
bound of 1



More information about the Gcc-bugs mailing list