[flang-commits] [flang] [Flang] Extra check for character length in pointer allocation (PR #95145)

Carlos Seo via flang-commits flang-commits at lists.llvm.org
Mon Jun 17 09:31:54 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
----------------
ceseo wrote:

Yes, you're right. We need to check for both situations. I'll fix that.

https://github.com/llvm/llvm-project/pull/95145


More information about the flang-commits mailing list