flang icon indicating copy to clipboard operation
flang copied to clipboard

Test which tracks default allocatable behaviour

Open pawosm-arm opened this issue 3 years ago • 1 comments

pawosm-arm avatar Sep 18 '22 20:09 pawosm-arm

In light of @kiranchandramohan's comment, perhaps we should have another test to make sure that -Mallocatable=95 still works. 😄 There are a number of tests which exercise -Mallocatable=03 but none that uses -Mallocatable=95.

bryanpkc avatar Sep 21 '22 14:09 bryanpkc

The test is checking that, with default compiler options, arr is allocated to match the dimensions of the array returned by get_array. In other words, it checks that -Mallocatable=03 (or -frealloc-lhs in GFortran terms) is enabled by default. If the test is compiled with -Mallocatable=95, running the test results in a segmentation fault, at least on my machine.

There are a large number of allocatable-related tests in test/f90_correct/src/al*.f90. I would approve this PR if the test is not already covered in one of the existing tests. It would be nice to rename the test to clarify the intent, e.g. allocatable_assignment.f90.

bryanpkc avatar Apr 19 '23 16:04 bryanpkc

The test is checking that, with default compiler options, arr is allocated to match the dimensions of the array returned by get_array. In other words, it checks that -Mallocatable=03 (or -freallocate-lhs in GFortran terms) is enabled by default. If the test is compiled with -Mallocatable=95, running the test results in a segmentation fault, at least on my machine.

There are a large number of allocatable-related tests in test/f90_correct/src/al*.f90. I would approve this PR if the test is not already covered in one of the existing tests. It would be nice to rename the test to clarify the intent, e.g. allocatable_assignment.f90.

Thanks for your comment @bryanpkc. Although there are similar tests, they are not as straight-forward as this one, so it still may have a value. I've renamed it as you'd suggested.

pawosm-arm avatar Apr 19 '23 22:04 pawosm-arm