[flang-commits] [flang] bbd998f - [flang][test] Expand test for legacy DATA initializer on invalid declarations (#222171)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 8 16:56:39 PDT 2026
Author: Eugene Epshteyn
Date: 2026-09-08T19:56:35-04:00
New Revision: bbd998f0186f5362d3c9c1cc575bf6ce20007685
URL: https://github.com/llvm/llvm-project/commit/bbd998f0186f5362d3c9c1cc575bf6ce20007685
DIFF: https://github.com/llvm/llvm-project/commit/bbd998f0186f5362d3c9c1cc575bf6ce20007685.diff
LOG: [flang][test] Expand test for legacy DATA initializer on invalid declarations (#222171)
Follow-up to #221170. Expands `flang/test/Semantics/data27.f90` with the
other shapes that crashed the same way before that fix and now produce
the expected error
Assisted-by: AI
Added:
Modified:
flang/test/Semantics/data27.f90
Removed:
################################################################################
diff --git a/flang/test/Semantics/data27.f90 b/flang/test/Semantics/data27.f90
index 4dd6230c0b957..b0c2e8a800e31 100644
--- a/flang/test/Semantics/data27.f90
+++ b/flang/test/Semantics/data27.f90
@@ -1,7 +1,39 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
+! Legacy DATA-style initialization on declarations that are in error.
+! Each shape here used to crash instead of emitting the error.
program main
type foo
end type foo
!ERROR: 'foo' is already declared in this scoping unit
integer foo(1) /2/
end program main
+subroutine s1
+ type foo
+ end type foo
+ !ERROR: 'foo' is already declared in this scoping unit
+ integer foo /1/
+end subroutine
+subroutine s2
+ interface foo
+ end interface
+ !ERROR: 'foo' is already declared in this scoping unit
+ integer foo /1/
+end subroutine
+subroutine s3
+ type foo
+ end type foo
+ !ERROR: 'foo' is already declared in this scoping unit
+ character foo*3 /'abc'/
+end subroutine
+subroutine s4
+ type foo
+ end type foo
+ !ERROR: 'foo' is already declared in this scoping unit
+ integer foo(1) /2/, ok(1) /3/
+end subroutine
+subroutine s5
+ integer :: x
+ namelist /foo/ x
+ !ERROR: 'foo' is already declared in this scoping unit
+ integer foo /1/
+end subroutine
More information about the flang-commits
mailing list