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
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
18 changes: 15 additions & 3 deletions flang/docs/Extensions.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!--===- docs/Extensions.md
<!--===- docs/Extensions.md

Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

-->

# Fortran Extensions supported by Flang
Expand Down Expand Up @@ -170,6 +170,18 @@ end
In the case of `DEFERRED` bindings in an `ABSTRACT` derived type,
however, overrides are necessary, so they are permitted for inaccessible
bindings with an optional warning.
* Main program name is allowed to be the same as the other symbols used
in the main program, for example:
```
module m
end
program m
use m
end
```
Note that internally the main program symbol name is all uppercase, unlike
the names of all other symbols, which are usually all lowercase. This
may make a difference in testing/debugging.

## Extensions, deletions, and legacy features supported by default

Expand Down
3 changes: 1 addition & 2 deletions flang/lib/Semantics/check-omp-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,7 @@ void OmpStructureChecker::CheckThreadprivateOrDeclareTargetVar(
(sym->has<MainProgramDetails>() ||
sym->has<ModuleDetails>())) {
context_.Say(name->source,
"The module name or main program name cannot be in a "
"%s "
"The module name cannot be in a %s "
"directive"_err_en_US,
ContextDirectiveAsFortran());
} else if (!IsSaved(*name->symbol) &&
Expand Down
25 changes: 20 additions & 5 deletions flang/lib/Semantics/resolve-labels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,30 @@ class ParseTreeAnalyzer {

// C1401
void Post(const parser::MainProgram &mainProgram) {
// 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())};
char *endCh{ch + cb.size()};
while (ch != endCh) {
*ch++ = parser::ToUpperCaseLetter(*ch);
}
};
const parser::CharBlock *progName{nullptr};
if (const auto &program{
std::get<std::optional<parser::Statement<parser::ProgramStmt>>>(
mainProgram.t)}) {
progName = &program->statement.v.source;
upperCaseCharBlock(*progName);
}
if (const parser::CharBlock *
endName{GetStmtName(std::get<parser::Statement<parser::EndProgramStmt>>(
mainProgram.t))}) {
if (const auto &program{
std::get<std::optional<parser::Statement<parser::ProgramStmt>>>(
mainProgram.t)}) {
if (*endName != program->statement.v.source) {
upperCaseCharBlock(*endName);
if (progName) {
if (*endName != *progName) {
context_.Say(*endName, "END PROGRAM name mismatch"_err_en_US)
.Attach(program->statement.v.source, "should be"_en_US);
.Attach(*progName, "should be"_en_US);
}
} else {
context_.Say(*endName,
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/cuda-option.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program main
integer, device :: dvar
end program

! CHECK-LABEL: PROGRAM main
! CHECK-LABEL: PROGRAM MAIN
! CHECK: INTEGER :: var = 1
! CHECK: INTEGER, DEVICE :: dvar

Expand Down
4 changes: 2 additions & 2 deletions flang/test/Driver/unparse-use-analyzed.f95
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
! RUN: %flang_fc1 -fdebug-unparse %s | FileCheck %s --check-prefix=DEFAULT
! RUN: %flang_fc1 -fdebug-unparse -fno-analyzed-objects-for-unparse %s | FileCheck %s --check-prefix=DISABLED

! DEFAULT: PROGRAM test
! DEFAULT: PROGRAM TEST
! DEFAULT-NEXT: REAL, PARAMETER :: val = 3.43e2_4
! DEFAULT-NEXT: PRINT *, 3.47e2_4
! DEFAULT-NEXT: END PROGRAM

! DISABLED: PROGRAM test
! DISABLED: PROGRAM TEST
! DISABLED-NEXT: REAL, PARAMETER :: val = 343.0
! DISABLED-NEXT: PRINT *, val+4
! DISABLED-NEXT: END PROGRAM
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Driver/unparse-with-modules.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ program test
!CHECK: implicit none
!CHECK: real(kind=real32) x
!CHECK: end module
!CHECK: program test
!CHECK: program TEST
!CHECK: use :: m1
!CHECK: use :: basictestmoduletwo
!CHECK: implicit none
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Integration/debug-common-block-1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ program test
! CHECK-DAG: ![[CBF3]] = !DICommonBlock(scope: ![[F3]], declaration: null, name: "__BLNK__"{{.*}})
! CHECK-DAG: ![[CBAF3]] = !DICommonBlock(scope: ![[F3]], declaration: null, name: "a"{{.*}})

! CHECK-DAG: ![[MAIN:[0-9]+]] = {{.*}}!DISubprogram(name: "test"{{.*}})
! CHECK-DAG: ![[MAIN:[0-9]+]] = {{.*}}!DISubprogram(name: "TEST"{{.*}})
! CHECK-DAG: ![[CBM]] = !DICommonBlock(scope: ![[MAIN]], declaration: null, name: "__BLNK__"{{.*}})
! CHECK-DAG: ![[CBAM]] = !DICommonBlock(scope: ![[MAIN]], declaration: null, name: "a"{{.*}})

Expand Down
2 changes: 1 addition & 1 deletion flang/test/Integration/debug-local-var-2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
! BOTH-LABEL: }

program mn
! BOTH-DAG: ![[MAIN:.*]] = distinct !DISubprogram(name: "mn", {{.*}})
! BOTH-DAG: ![[MAIN:.*]] = distinct !DISubprogram(name: "MN", {{.*}})

! BOTH-DAG: ![[TYI32:.*]] = !DIBasicType(name: "integer", size: 32, encoding: DW_ATE_signed)
! BOTH-DAG: ![[TYI64:.*]] = !DIBasicType(name: "integer", size: 64, encoding: DW_ATE_signed)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/CUDA/cuda-derived.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ program main
type(t2) :: b
end

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "main"}
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"}
! CHECK: %{{.*}} = cuf.alloc !fir.type<_QMm1Tty_device{x:!fir.box<!fir.heap<!fir.array<?xi32>>>}> {bindc_name = "a", data_attr = #cuf.cuda<managed>, uniq_name = "_QFEa"}
! CHECK: %{{.*}} = cuf.alloc !fir.type<_QMm1Tt2{b:!fir.type<_QMm1Tt1{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>}> {bindc_name = "b", data_attr = #cuf.cuda<managed>, uniq_name = "_QFEb"}
2 changes: 1 addition & 1 deletion flang/test/Lower/CUDA/cuda-return01.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ program main
return
end

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "main"}
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"}
! CHECK: cuf.alloc !fir.box<!fir.heap<!fir.array<?xi32>>> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
! CHECK-NOT: cuf.free
2 changes: 1 addition & 1 deletion flang/test/Lower/CUDA/cuda-return02.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ program test
return
end

! CHECK: func.func @_QQmain() attributes {fir.bindc_name = "test"} {
! CHECK: func.func @_QQmain() attributes {fir.bindc_name = "TEST"} {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare
! CHECK: cf.cond_br %{{.*}}, ^bb1, ^bb2
! CHECK-NEXT: ^bb1:
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/intrinsic-subroutines.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ program main
call mvbits(from, 2, 2, to, 0)
if (any(to /= 5)) STOP 1
end program
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
! CHECK: %[[VAL_0:.*]] = arith.constant 3 : index
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.array<3xi32> {bindc_name = "from", uniq_name = "_QFEfrom"}
! CHECK: %[[VAL_2:.*]] = fir.shape %[[VAL_0]] : (index) -> !fir.shape<1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FUNCTION BAR() RESULT(res)
END
END

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.type<_QMmTdt{pp1:!fir.boxproc<(!fir.ref<i32>) -> i32>}>
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.type<_QMmTdt{pp1:!fir.boxproc<(!fir.ref<i32>) -> i32>}>
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.boxproc<(!fir.ref<i32>) -> i32> {bindc_name = "pp2", uniq_name = "_QFEpp2"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenACC/acc-atomic-read.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ program acc_atomic_test
g = h
end program acc_atomic_test

! CHECK: func @_QQmain() attributes {fir.bindc_name = "acc_atomic_test"} {
! CHECK: func @_QQmain() attributes {fir.bindc_name = "ACC_ATOMIC_TEST"} {
! CHECK: %[[VAR_G:.*]] = fir.alloca f32 {bindc_name = "g", uniq_name = "_QFEg"}
! CHECK: %[[G_DECL:.*]]:2 = hlfir.declare %[[VAR_G]] {uniq_name = "_QFEg"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
! CHECK: %[[VAR_H:.*]] = fir.alloca f32 {bindc_name = "h", uniq_name = "_QFEh"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenACC/acc-atomic-write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

! This test checks the lowering of atomic write

!CHECK: func @_QQmain() attributes {fir.bindc_name = "acc_atomic_write_test"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "ACC_ATOMIC_WRITE_TEST"} {
!CHECK: %[[VAR_X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
!CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[VAR_X]] {uniq_name = "_QFEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[VAR_Y:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenACC/acc-routine04.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ subroutine sub2()
! CHECK: acc.routine @acc_routine_1 func(@_QFPsub2) seq
! CHECK: acc.routine @acc_routine_0 func(@_QMdummy_modPsub1) seq
! CHECK: func.func @_QMdummy_modPsub1(%arg0: !fir.ref<i32> {fir.bindc_name = "i"}) attributes {acc.routine_info = #acc.routine_info<[@acc_routine_0]>}
! CHECK: func.func @_QQmain() attributes {fir.bindc_name = "test_acc_routine"}
! CHECK: func.func @_QQmain() attributes {fir.bindc_name = "TEST_ACC_ROUTINE"}
! CHECK: func.func private @_QFPsub2() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_1]>, fir.host_symbol = @_QQmain, llvm.linkage = #llvm.linkage<internal>}
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/atomic-read.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

! This test checks the lowering of atomic read

!CHECK: func @_QQmain() attributes {fir.bindc_name = "ompatomic"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "OMPATOMIC"} {
!CHECK: %[[A_REF:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
!CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A_REF]] {uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[B_REF:.*]] = fir.alloca i32 {bindc_name = "b", uniq_name = "_QFEb"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/atomic-write.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

! This test checks the lowering of atomic write

!CHECK: func @_QQmain() attributes {fir.bindc_name = "ompatomicwrite"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "OMPATOMICWRITE"} {
!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
!CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X_REF]] {uniq_name = "_QFEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[Y_REF:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFEy"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/common-atomic-lowering.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s

!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "sample"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "SAMPLE"} {
!CHECK: %[[val_0:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
!CHECK: %[[val_1:.*]]:2 = hlfir.declare %[[val_0]] {uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[val_2:.*]] = fir.alloca i32 {bindc_name = "b", uniq_name = "_QFEb"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/cray-pointers02.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Test lowering of Cray pointee references.
! RUN: flang -fc1 -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "test_cray_pointers_02"}
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "TEST_CRAY_POINTERS_02"}
program test_cray_pointers_02
implicit none

Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/default-clause-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
!CHECK: omp.yield(%[[PRIV_X]] : !fir.ref<i32>)
!CHECK: }

!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "DEFAULT_CLAUSE_LOWERING"} {
!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = "_QFEw"}
!CHECK: %[[W_DECL:.*]]:2 = hlfir.declare %[[W]] {uniq_name = "_QFEw"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/default-clause.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
! RUN: | FileCheck %s


!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "DEFAULT_CLAUSE_LOWERING"} {
!CHECK: %[[W:.*]] = fir.alloca i32 {bindc_name = "w", uniq_name = "_QFEw"}
!CHECK: %[[W_DECL:.*]]:2 = hlfir.declare %[[W]] {uniq_name = "_QFEw"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ program reduce
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE"} {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEi) : !fir.ref<i32>
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = fir.address_of(@_QFEr) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-reduction-array-lb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ program reduce
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE"} {
! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.box<!fir.array<3x2xi32>>
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEi) : !fir.ref<!fir.array<3x2xi32>>
! CHECK: %[[VAL_1:.*]] = arith.constant 2 : index
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-reduction-array2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ program reduce
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE"} {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEi) : !fir.ref<!fir.array<3xi32>>
! CHECK: %[[VAL_1:.*]] = arith.constant 3 : index
! CHECK: %[[VAL_2:.*]] = fir.shape %[[VAL_1]] : (index) -> !fir.shape<1>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-reduction-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
!CHECK: fir.store %[[CR]] to %[[C0]] : !fir.ref<i32>
!CHECK: omp.yield(%[[C0]] : !fir.ref<i32>)
!CHECK: }
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "mn"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "MN"} {
!CHECK: %[[RED_ACCUM_REF:[_a-z0-9]+]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
!CHECK: %[[RED_ACCUM_DECL:[_a-z0-9]+]]:2 = hlfir.declare %[[RED_ACCUM_REF]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[C0:[_a-z0-9]+]] = arith.constant 0 : i32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ program reduce
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE"} {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEi) : !fir.ref<i32>
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = fir.address_of(@_QFEr) : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-reduction-rename.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end program main
! CHECK: omp.yield(%[[VAL_2]] : i32)
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "n", uniq_name = "_QFEn"}
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFEn"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = arith.constant 0 : i32
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-reduction.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
!CHECK: %[[CR:[_a-z0-9]+]] = arith.addi %[[C0]], %[[C1]] : i32
!CHECK: omp.yield(%[[CR]] : i32)
!CHECK: }
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "mn"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "MN"} {
!CHECK: %[[RED_ACCUM_REF:[_a-z0-9]+]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
!CHECK: %[[RED_ACCUM_DECL:[_a-z0-9]+]]:2 = hlfir.declare %[[RED_ACCUM_REF]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[C0:[_a-z0-9]+]] = arith.constant 0 : i32
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/sections.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
! RUN: bbc -hlfir -emit-hlfir %openmp_flags %s -o - | FileCheck %s

!CHECK: func @_QQmain() attributes {fir.bindc_name = "sample"} {
!CHECK: func @_QQmain() attributes {fir.bindc_name = "SAMPLE"} {
!CHECK: %[[COUNT:.*]] = fir.address_of(@_QFEcount) : !fir.ref<i32>
!CHECK: %[[COUNT_DECL:.*]]:2 = hlfir.declare %[[COUNT]] {uniq_name = "_QFEcount"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[ETA:.*]] = fir.alloca f32 {bindc_name = "eta", uniq_name = "_QFEeta"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s

!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
!CHECK: %[[A:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
!CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] {fortran_attrs = #fir.var_attrs<internal_assoc>, uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[A_ADDR:.*]] = fir.address_of(@_QFEa) : !fir.ref<i32>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s

!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
!CHECK: %[[A:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
!CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] {fortran_attrs = #fir.var_attrs<internal_assoc>, uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[A_ADDR:.*]] = fir.address_of(@_QFEa) : !fir.ref<i32>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/threadprivate-host-association.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s

!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "main"} {
!CHECK: func.func @_QQmain() attributes {fir.bindc_name = "MAIN"} {
!CHECK: %[[A:.*]] = fir.address_of(@_QFEa) : !fir.ref<i32>
!CHECK: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]] {fortran_attrs = #fir.var_attrs<internal_assoc>, uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[TP_A:.*]] = omp.threadprivate %[[A_DECL]]#0 : !fir.ref<i32> -> !fir.ref<i32>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/wsloop-chunks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ program wsloop
integer :: i
integer :: chunk

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "wsloop"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "WSLOOP"} {
! CHECK: %[[CHUNK_REF:.*]] = fir.alloca i32 {bindc_name = "chunk", uniq_name = "_QFEchunk"}
! CHECK: %[[VAL_0:.*]]:2 = hlfir.declare %[[CHUNK_REF]] {uniq_name = "_QFEchunk"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)

Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/wsloop-collapse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s

!CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "wsloop_collapse"} {
!CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "WSLOOP_COLLAPSE"} {
program wsloop_collapse
!CHECK: %[[VAL_6:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
!CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ program reduce15
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce15"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE15"} {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEarr) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = {{.*}}<allocatable>, uniq_name = "_QFEarr"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-allocatable.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ program reduce
! CHECK: omp.yield
! CHECK: }

! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "reduce"} {
! CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "REDUCE"} {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QFEi) : !fir.ref<i32>
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.heap<i32>> {bindc_name = "r", uniq_name = "_QFEr"}
Expand Down
Loading