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
12module m
13  integer, parameter :: PARA(*) = [1,2,3,4,5,6,7,8,9,10]
14end module m
15
16subroutine test()
17use m
18integer :: i
19i = 1
20if (para(i) /= 1) call i_am_optimized_away()
21end
22