fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / assumed_charlen_in_main.f90
blobf4bb701548d6b316709e848d8a61c4aa6848d5c3
1 ! { dg-do compile }
2 ! Tests the fix for PR28771 in which an assumed character length variable with an initializer could
3 ! survive in the main program without causing an error.
5 ! Contributed by Martin Reinecke <martin@mpa-garching.mpg.de>
6 ! Modified to test fix of regression reported by P.Schaffnit@access.rwth-aachen.de
8 subroutine poobar ()
9 ! The regression caused an ICE here
10 CHARACTER ( LEN = * ), PARAMETER :: Markers(5) = (/ "Error ", &
11 & "Fehler", &
12 & "Erreur", &
13 & "Stop ", &
14 & "Arret " /)
15 character(6) :: recepteur (5)
16 recepteur = Markers
17 end subroutine poobar
19 ! If the regression persisted, the compilation would stop before getting here
20 program test
21 character(len=*), parameter :: foo = 'test' ! Parameters must work.
22 character(len=4) :: bar = foo
23 character(len=*) :: foobar = 'This should fail' ! { dg-error "must be a dummy" }
24 print *, bar
25 call poobar ()
26 end