aboutsummaryrefslogtreecommitdiff
path: root/flang/test/Parser
diff options
context:
space:
mode:
authorPeter Klausler <35819229+klausler@users.noreply.github.com>2023-12-11 13:09:12 -0800
committerGitHub <noreply@github.com>2023-12-11 13:09:12 -0800
commitea3a3b25b93664c8be750ac3cd550855dcd1848b (patch)
tree5be4359e6acfe034d8ae611db2033fa46905788f /flang/test/Parser
parent353d56d22bfb77ee48554705c50ee71b115854fd (diff)
downloadllvm-ea3a3b25b93664c8be750ac3cd550855dcd1848b.zip
llvm-ea3a3b25b93664c8be750ac3cd550855dcd1848b.tar.gz
llvm-ea3a3b25b93664c8be750ac3cd550855dcd1848b.tar.bz2
[flang] Handle continuation line edge case (#74751)
For a character literal that is split over more than one source line with free form line continuation using '&' at the end of one line but missing the standard-required '&' on the continuation line, also handle the case of spaces at the beginning of the continuation line. For example, PRINT *, 'don'& 't poke the bear' now prints "don't poke the bear", like nearly all other Fortran compilers do. This is not strictly standard conforming behavior, and the compiler emits a portability warning with -pedantic. Fixes llvm-test-suite/Fortran/gfortran/regression/continuation_1.f90, .../continuation_12.f90, and .../continuation_13.f90.
Diffstat (limited to 'flang/test/Parser')
-rw-r--r--flang/test/Parser/continuation-before-quote.f9010
-rw-r--r--flang/test/Parser/continuation-without-ampersand.f9013
2 files changed, 13 insertions, 10 deletions
diff --git a/flang/test/Parser/continuation-before-quote.f90 b/flang/test/Parser/continuation-before-quote.f90
deleted file mode 100644
index 66252010..0000000
--- a/flang/test/Parser/continuation-before-quote.f90
+++ /dev/null
@@ -1,10 +0,0 @@
-! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
-! Continuation between repeated quotation marks
-subroutine test
-!CHECK: portability: Repeated quote mark in character literal continuation line should have been preceded by '&'
- print *, 'needs an '&
-'ampersand'''
-!CHECK-NOT: portability: Repeated quote mark in character literal continuation line should have been preceded by '&'
- print *, 'has an '&
-&'ampersand'''
-end
diff --git a/flang/test/Parser/continuation-without-ampersand.f90 b/flang/test/Parser/continuation-without-ampersand.f90
new file mode 100644
index 0000000..5c3f232
--- /dev/null
+++ b/flang/test/Parser/continuation-without-ampersand.f90
@@ -0,0 +1,13 @@
+! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
+! Continuation between repeated quotation marks
+subroutine test
+!CHECK: portability: Character literal continuation line should have been preceded by '&'
+ print *, 'needs an '&
+'ampersand'''
+!CHECK: portability: Character literal continuation line should have been preceded by '&'
+ print *, 'also needs an '&
+ 'ampersand'''
+!CHECK-NOT: portability: Character literal continuation line should have been preceded by '&'
+ print *, 'has an '&
+&'ampersand'''
+end