https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102787
--- Comment #1 from anlauf at gcc dot gnu.org ---
Interesting. Cannot reproduce on x86_64-pc-linux-gnu.
However, changing the testcase as follows:
program p
integer, parameter :: a(1) = 2
! integer, parameter :: b(2) = reshape([3,4], -[a]) ! { dg-error "negative" }
integer, parameter :: b(2) = reshape([3,4], - a ) ! { dg-error "negative" }
end
thus removing the array constructor, I get an error pointing to the wrong line:
reshape_shape_2a.f90:5:30:
5 | integer, parameter :: a(1) = 2
| 1
Error: 'shape' argument of 'reshape' intrinsic at (1) has negative element (-2)
which is (correctly) coming from gfc_check_reshape that shows up in your
backtrace.
Possibly several latent issues uncovered by the testcase.
Need to dig deeper.