diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/associate_23.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/associate_23.f90 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/associate_23.f90 b/gcc/testsuite/gfortran.dg/associate_23.f90 new file mode 100644 index 00000000000..b4d58ffd2b7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_23.f90 @@ -0,0 +1,36 @@ +! { dg-do run } +! +! Tests the fix for PR64933 +! +! Contributed by Olivier Marsden <olivier.marsden@ecmwf.int> +! +program test_this + implicit none + character(len = 15) :: char_var, char_var_dim (3) + character(len = 80) :: buffer + +! Original failing case reported in PR + ASSOCIATE(should_work=>char_var) + should_work = "test succesful" + write (buffer, *) should_work(5:14) + END ASSOCIATE + + if (trim (buffer) .ne. " succesful") call abort + +! Found to be failing during debugging + ASSOCIATE(should_work=>char_var_dim) + should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"] + write (buffer, *) should_work(:)(5:14) + END ASSOCIATE + + if (trim (buffer) .ne. " SUCCESFUL_SUCCESFUL.SUCCESFUL") call abort + +! Found to be failing during debugging + ASSOCIATE(should_work=>char_var_dim(1:2)) + should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"] + write (buffer, *) should_work(:)(5:14) + END ASSOCIATE + + if (trim (buffer) .ne. " SUCCESFUL_SUCCESFUL") call abort + +end program |