gcc/testsuite/gfortran.dg/module_parameter_array_refs_2.f90
raw| 1 | ! { dg-do compile } |
| 2 | ! { dg-options "-O" } |
| 3 | ! { dg-final { scan-assembler-not "i_am_optimized_away" } } |
| 4 | ! |
| 5 | ! PR fortran/50960 |
| 6 | ! |
| 7 | ! PARAMETER arrays and derived types exists as static variables. |
| 8 | ! Check that the their read-only nature is taken into account |
| 9 | ! when optimizations are done. |
| 10 | ! |
| 11 | |
| 12 | module m |
| 13 | integer, parameter :: PARA(*) = [1,2,3,4,5,6,7,8,9,10] |
| 14 | end module m |
| 15 | |
| 16 | subroutine test() |
| 17 | use m |
| 18 | integer :: i |
| 19 | i = 1 |
| 20 | if (para(i) /= 1) call i_am_optimized_away() |
| 21 | end |