-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang2] Fix bug in implied DO expression in a used module
The variables in a common block from a module will be copied into current scope when a USE exists. However, the dinit feature of those copied variables was removed when lowering symbols in flang1. This patch suppresses the transformation of those copied variables to the corresponding constant initialized in the common block, since we cannot get their initialization info anyway.
- Loading branch information
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# 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 | ||
# | ||
|
||
$(TEST): run | ||
|
||
|
||
build: $(SRC)/$(TEST).f90 | ||
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.* | ||
@echo ------------------------------------ building test $@ | ||
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX) | ||
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX) | ||
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) check.$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX) | ||
|
||
|
||
run: | ||
@echo ------------------------------------ executing test $(TEST) | ||
$(TEST).$(EXESUFFIX) | ||
|
||
verify: ; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# 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 | ||
|
||
# Shared lit script for each tests. Run bash commands that run tests with make. | ||
|
||
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t | ||
# RUN: cat %t | FileCheck %S/runmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
! 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 | ||
! | ||
! Test the implied DO expression in module. | ||
! | ||
|
||
module mod_impliedDo | ||
integer :: i | ||
character(*), parameter :: a = "Hello world!" | ||
character(*), parameter :: b1(2) = [(a(i:i+4),i=1,7,6)] | ||
end module | ||
|
||
program p | ||
use mod_impliedDo | ||
character(5) :: c(2) | ||
c(1) = b1(1) | ||
c(2) = b1(2) | ||
call check(c, "Helloworld", 1) | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters