Skip to content

[flang] Fix prescanner bug w/ empty macros in line continuation #141274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/lib/Parser/prescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
GetProvenanceRange(p, p + 1),
"Character literal continuation line should have been preceded by '&'"_port_en_US);
}
} else if (p > lineStart) {
} else if (p > lineStart && IsSpaceOrTab(p - 1)) {
--p;
} else {
insertASpace_ = true;
Expand Down
6 changes: 6 additions & 0 deletions flang/test/Preprocessing/bug890.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
! RUN: %flang -E %s 2>&1 | FileCheck %s
!CHECK: subroutine sub()
#define empty
subroutine sub ( &
empty)
end