-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flang1] Fix the string operation of file name
This bug came from 0bcbadb, which uses strdup to allocate non-const versions of const string, but does not change the use of the original string. The use of original string (file name) terminates the string by removing the last directory. So, we need to replace the use of original string with the allocated string.
- Loading branch information
1 parent
310393a
commit a510c3e
Showing
8 changed files
with
111 additions
and
1 deletion.
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,30 @@ | ||
# | ||
# 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 $@ | ||
-$(MKDIR) import_mod_from_user_dir1 | ||
-$(CD) import_mod_from_user_dir1 | ||
-$(CP) $(SRC)/import_mod_from_user_dir1_m2.f90 . | ||
-$(FC) -c import_mod_from_user_dir1_m2.f90 | ||
-$(CD) .. | ||
-$(MKDIR) import_mod_from_user_dir2 | ||
-$(CD) import_mod_from_user_dir2 | ||
-$(CP) $(SRC)/import_mod_from_user_dir2* . | ||
-$(FC) -c import_mod_from_user_dir2_m2.f90 | ||
-$(FC) -c import_mod_from_user_dir2_m1.f90 | ||
-$(CD) .. | ||
-$(FC) -c -I./import_mod_from_user_dir1 -I./import_mod_from_user_dir2 $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX) | ||
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(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
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,17 @@ | ||
! | ||
! 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 for the import module from the correct path. | ||
|
||
module import_mod_from_user | ||
contains | ||
subroutine sub() | ||
use import_source2 | ||
end | ||
end | ||
|
||
program import_mod_from_user_test | ||
print *, "PASS" | ||
end |
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,20 @@ | ||
! | ||
! 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 for the import module from the correct path. This file is in the wrong | ||
! path for testing. | ||
|
||
module import_source | ||
contains | ||
subroutine sub1() | ||
end | ||
|
||
subroutine sub3() | ||
end | ||
|
||
function func() result(funit) | ||
integer :: funit | ||
end | ||
end |
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,11 @@ | ||
! | ||
! 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 for the import module from the correct path. This file is in the | ||
! correct path. | ||
|
||
module import_source2 | ||
use import_source, only : func, sub1 | ||
end |
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 for the import module from the correct path. This file is in the | ||
! correct path. | ||
|
||
module import_source | ||
contains | ||
subroutine sub1() | ||
end | ||
|
||
subroutine sub2(m) | ||
integer, intent(out) :: m | ||
end | ||
|
||
function func() result(funit) | ||
integer :: funit | ||
end | ||
end |
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