Peter Klausler b4f9012464
[flang] Make a non-digit in fixed-form label field an error unless -E (#174836)
A character in a fixed-form source line (as opposed to a comment or
compiler directive) can't have a non-digit in its label field, columns 1
through 5. The prescanner presently emits only a warning for this case.
Retain the warning for -E output, but otherwise diagnose an error.

(This change affected a number of tests that relied on this situation
being a warning just so that they could test prescanner warnings, and
those tests were adjusted to use another warning.)

Fixes https://github.com/llvm/llvm-project/issues/50563.
2026-01-08 08:58:45 -08:00

22 lines
545 B
Fortran

! RUN: %flang -E %s 2>&1 | FileCheck %s
! CHECK: warning: Character in fixed-form label field should be a digit
! CHECK: res = IFLM
! CHECK: (666)
! CHECK-NOT: res = ((666)+111)
* FLM call with '(' on next line (not a continuation)
integer function IFLM(x)
integer :: x
IFLM = x
end function IFLM
program main
#define IFLM(x) ((x)+111)
integer :: res
res = IFLM
(666)
if (res .eq. 777) then
print *, 'pp039.F yes'
else
print *, 'pp039.F no: ', res
end if
end