Skip to content

[flang] Main program symbol no longer conflicts with the other symbols #149169

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 15 commits into from
Jul 17, 2025

Conversation

eugeneepshteyn
Copy link
Contributor

@eugeneepshteyn eugeneepshteyn commented Jul 16, 2025

The following code is now accepted:

module m
end
program m
use m
end

The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts.

This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream.

Modified the tests that were checking for lower case main program name.

Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Developer Policy and LLVM Discourse for more information.

@eugeneepshteyn
Copy link
Contributor Author

eugeneepshteyn commented Jul 16, 2025

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo. Please turn off Keep my email addresses private setting in your account. See LLVM Developer Policy and LLVM Discourse for more information.

I'm not using private e-mail address.

@eugeneepshteyn eugeneepshteyn marked this pull request as ready for review July 16, 2025 19:21
// Uppercase the name of the main program, so that its symbol name
// would be unique from similarly named non-main-program symbols.
auto upperCaseCharBlock = [](const parser::CharBlock &cb) {
char *ch = const_cast<char *>(cb.begin());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please always use braced initialization in the bits of flang-new that are modern C++.

}
const parser::CharBlock *endName{GetStmtName(
std::get<parser::Statement<parser::EndProgramStmt>>(mainProgram.t))};
if (endName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two if statements could each be combined with the preceding local variable declarations.

@eugeneepshteyn eugeneepshteyn merged commit 413e71b into llvm:main Jul 17, 2025
10 checks passed
@eugeneepshteyn eugeneepshteyn deleted the main-sym-conflict-4 branch July 17, 2025 18:18
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 18, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/34156

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Semantics/PowerPC/ppc-vector-types01.f90' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -fdebug-unparse /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90 | /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90 # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang -fc1 -fdebug-unparse /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90:4:17: error: CHECK-LABEL: expected string not found in input
 ! CHECK-LABEL: PROGRAM ppc_vec_unit
                ^
<stdin>:1:1: note: scanning from here
PROGRAM PPC_VEC_UNIT
^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Semantics/PowerPC/ppc-vector-types01.f90

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         1: PROGRAM PPC_VEC_UNIT 
label:4     X~~~~~~~~~~~~~~~~~~~~ error: no match found
         2:  IMPLICIT NONE 
label:4     ~~~~~~~~~~~~~~~
         3:  VECTOR(INTEGER(KIND=4_4)) :: vi1, vi2 
label:4     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         4:  VECTOR(REAL(KIND=8_4)) :: vr1, vr2 
label:4     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         5:  VECTOR(UNSIGNED(KIND=2_4)) :: vu1, vu2 
label:4     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         6:  __VECTOR_PAIR :: vp1, vp2 
label:4     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
         .
         .
         .
>>>>>>

--

********************


@eugeneepshteyn
Copy link
Contributor Author

eugeneepshteyn commented Jul 18, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/34156

Here is the relevant piece of the build log for the reference

Test modifications: #149508

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

Successfully merging this pull request may close these issues.

3 participants