[flang-commits] [flang] [Flang] Extra check for character length in pointer allocation (PR #95145)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Jun 17 09:13:51 PDT 2024
================
@@ -0,0 +1,18 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Check for semantic errors in ALLOCATE statements
+
+! C934
+! If type-spec appears, it shall specify a type with which each
+! allocate-object is type compatible.
+! Issue #78939: allocatable object has a non-defined character length.
+
+module m1
+ integer::nn=1
+end module m1
+
+program main
+ use m1
+ character(nn),pointer::c1s
+ !ERROR: Character length of allocatable object in ALLOCATE must be the same as the type-spec
----------------
klausler wrote:
This might be a valid error if `nn` were a `PARAMETER` in the module and not a variable that could be modified to be 2.
https://github.com/llvm/llvm-project/pull/95145
More information about the flang-commits
mailing list