Skip to content
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

[flang] Incorrect preprocesor output #117297

Open
shivaramaarao opened this issue Nov 22, 2024 · 3 comments · May be fixed by #117407
Open

[flang] Incorrect preprocesor output #117297

shivaramaarao opened this issue Nov 22, 2024 · 3 comments · May be fixed by #117407
Assignees

Comments

@shivaramaarao
Copy link

shivaramaarao commented Nov 22, 2024

for the following program:
#define NOCOMMENT
NOCOMMENT CALL myfunc( 'hello ' // &
NOCOMMENT 'world' // &
NOCOMMENT 'again' )

The correct preprocessor output is
CALL myfunc( 'hello ' // &
'world' //
'again' )

flang is not able to scan this code and gives following error
flang -E -ffree-form x1.F
error: Could not scan x1.F
./x1.F:2:25: error: Unmatched '('
NOCOMMENT CALL myfunc( 'hello ' // &
^
./x1.F:4:22: error: Unmatched ')'
NOCOMMENT 'again' )
^

@github-actions github-actions bot added the flang Flang issues not falling into any other category label Nov 22, 2024
@EugeneZelenko EugeneZelenko added flang:frontend and removed flang Flang issues not falling into any other category labels Nov 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2024

@llvm/issue-subscribers-flang-frontend

Author: None (shivaramaarao)

for the following program: #define NOCOMMENT NOCOMMENT CALL myfunc( 'hello ' // & NOCOMMENT 'world' // NOCOMMENT 'again' )

The correct preprocessor output is
CALL myfunc( 'hello ' // &
'world' //
'again' )

flang is not able to scan this code and gives following error
flang -E -ffree-form x1.F
error: Could not scan x1.F
./x1.F:2:25: error: Unmatched '('
NOCOMMENT CALL myfunc( 'hello ' // &
^
./x1.F:4:22: error: Unmatched ')'
NOCOMMENT 'again' )
^

@klausler
Copy link
Contributor

You're missing a line continuation marker at the end of the line containing world.

@klausler klausler self-assigned this Nov 23, 2024
klausler added a commit to klausler/llvm-project that referenced this issue Nov 23, 2024
A free form source line that begins with a macro should still be
classified as a source line, and have its continuation lines work,
even if the macro expands to an empty replacement.

Fixes llvm#117297.
@shivaramaarao
Copy link
Author

You're missing a line continuation marker at the end of the line containing world.

Thanks. Corrected the testcase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants