Fortran · 968 bytes Raw Blame History
1 ! audit31 Finding 18: a multi-line CHARACTER literal continued with a
2 ! trailing `&` and resumed on the next line whose first non-blank
3 ! character is `!` produced "lexer error: unterminated string literal".
4 ! The preprocessor's per-line macro expander walked into the open
5 ! string on line N, exited at end-of-line, and on line N+1 — having
6 ! lost the in-string state — treated the leading `!` (after the
7 ! continuation marker) as the start of a Fortran comment and stripped
8 ! the rest of the literal, including the closing quote. Sprint 31
9 ! #470 fixed the single-line `&!` case; this is the continuation
10 ! counterpart. Fix: have find_code_trailing_ampersand recognise a
11 ! trailing `&` inside an unterminated string as a continuation so the
12 ! preprocessor joins the lines BEFORE expansion runs. Task #499.
13 ! CHECK: hello !world
14 program audit31_bang_amp_multi
15 implicit none
16 character(len=12) :: s
17 s = 'hello &
18 &!world'
19 print *, trim(s)
20 end program
21