Files
llvm-project/flang/test/Semantics/cdefined.f90
Eugene Epshteyn 9702ec056b [flang] Fixed regression with CDEFINED linkage (#164616)
https://github.com/llvm/llvm-project/pull/162722 introduced a regression
that started creating initializers for CDEFINED variables. CDEFINED
variables cannot have initializers, because their storage is expected
come from elsewhere, likely outside of Fortran. Fixed the regression and
improved the regression test to catch the incorrect initialization case.

Also, based on the code review feedback, made CDEFINED variable
initialization a hard error and updated tests accordingly.
2025-10-27 18:26:08 -04:00

7 lines
194 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
module m
use iso_c_binding
!ERROR: CDEFINED variable cannot be initialized
integer(c_int), bind(C, name='c_global', CDEFINED) :: c = 42
end