[flang-commits] [flang] [flang][semantics] fix IsConstantExpr for intrinsic with optional argument (PR #161915)
Daniel Chen via flang-commits
flang-commits at lists.llvm.org
Sat Oct 4 07:57:48 PDT 2025
================
@@ -0,0 +1,15 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+type A (p, r)
+ integer, kind :: p, r
+ !ERROR: KIND parameter expression (int(selected_real_kind(six,twenty_three),kind=8)) of intrinsic type REAL did not resolve to a constant value
+ real (selected_real_kind(p, r)) :: data
+end type
+ integer :: six = 6, twenty_three = 23
+ type(a(6,23)) :: a1
+ !ERROR: Value of KIND type parameter 'p' must be constant
+ !ERROR: Value of KIND type parameter 'r' must be constant
+ !WARNING: specification expression refers to local object 'six' (initialized and saved) [-Wsaved-local-in-spec-expr]
+ !WARNING: specification expression refers to local object 'twenty_three' (initialized and saved) [-Wsaved-local-in-spec-expr]
+ type(a(six, twenty_three)) :: a2
----------------
DanielCChen wrote:
Nit: there is a trailing blank after `a2`, which caused a warning when apply the patch.
https://github.com/llvm/llvm-project/pull/161915
More information about the flang-commits
mailing list