Skip to content

Commit 2693fba

Browse files
wanbinchen-hncbryanpkc
authored andcommitted
[flang1] Fix handling of LBOUND/UBOUND in type specification
An issue occurs when LBOUND/UBOUND appears in the type specification of a function result and the DIM argument is missing. The root cause of this issue is that LBOUND/UBOUND is converted to runtime call in semantic phase, which is too early for type-spec of a function result. On the calling side of the function, we have no way of knowing whether LBOUND/UBOUND exists or its reference to the function's dummy arguments. We fix the issue by delaying the conversion to the tranform phase. In particular, we perform the conversion in dummy-actual argument replacement if the array argument of LBOUND/UBOUND is an assumed-shape array dummy. In addition, we fix an ICE that occurs when LBOUND/UBOUND appears in subscript expressions in type-spec, fix the link error that occurs when both DIM and KIND arguments are present, fix an issue with LBOUND on the last dimension of an assumed-size array, and add support for LBOUND/UBOUND on an assumed-rank array.
1 parent 0326f92 commit 2693fba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2054
-630
lines changed

test/f90_correct/inc/bound1.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound10.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
build: $(SRC)/$(TEST).f90
6+
@echo ------------------------------------ building test $(TEST)
7+
-$(FC) -c $(SRC)/$(TEST).f90 > $(TEST).rslt 2>&1
8+
9+
run:
10+
@echo ------------------------------------ nothing to run for test $(TEST)
11+
12+
verify: $(TEST).rslt
13+
@echo ------------------------------------ verifying test $(TEST)
14+
$(COMP_CHECK) $(SRC)/$(TEST).f90 $(TEST).rslt $(FC)

test/f90_correct/inc/bound11.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound12.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound13.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound14.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).F90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).F90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound15.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound16.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound2.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

test/f90_correct/inc/bound3.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See https://llvm.org/LICENSE.txt for license information.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
#
6+
7+
$(TEST): run
8+
9+
build: $(SRC)/$(TEST).f90
10+
-$(RM) $(TEST).$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
11+
@echo ------------------------------------ building test $@
12+
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/$(TEST).f90 -o $(TEST).$(OBJX)
13+
-$(FC) $(FFLAGS) $(LDFLAGS) $(TEST).$(OBJX) $(LIBS) -o $(TEST).$(EXESUFFIX)
14+
15+
run:
16+
@echo ------------------------------------ executing test $(TEST)
17+
$(TEST).$(EXESUFFIX)
18+
19+
verify: ;

0 commit comments

Comments
 (0)