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.
7 lines
194 B
Fortran
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
|