Skip to content

Commit 39bdfec

Browse files
authored
[Fortran/gfortran] Sync gfortran tests with upstream (#241)
These are synced with c182f4d14d65b3e012. Any new tests that fail have been added to the appropriate deny lists. The reasons for these failures have not been thoroughly investigated though, so some recategorization may be necessary. Some bugs in the build system for the tests was uncovered in the process and fixed.
1 parent 6dab75e commit 39bdfec

File tree

543 files changed

+45878
-618
lines changed

Some content is hidden

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

543 files changed

+45878
-618
lines changed

Fortran/gfortran/CMakeLists.txt

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ set(FLANG_ERRORING_FFLAGS
138138
-fdefault-real-10
139139
-fdefault-real-16
140140
-fdiagnostics-format=json
141+
-fdiagnostics-format=json-stderr
142+
-fdiagnostics-format=sarif-file
141143
-fdiagnostics-show-option
142144
-fdollar-ok
143145
-fdump-fortran-original
@@ -158,12 +160,15 @@ set(FLANG_ERRORING_FFLAGS
158160
-fdump-tree-fre1
159161
-fdump-tree-gimple
160162
-fdump-tree-ifcvt
163+
-fdump-tree-ivopts-all
161164
-fdump-tree-ldist-all
162165
-fdump-tree-ldist-details
163166
-fdump-tree-lim2
164167
-fdump-tree-lim2-details
165168
-fdump-tree-linterchange-details
166169
-fdump-tree-lversion-details
170+
-fdump-tree-ompdevlow
171+
-fdump-tree-ompexp
167172
-fdump-tree-omplower
168173
-fdump-tree-optimized
169174
-fdump-tree-optimized-raw
@@ -213,6 +218,8 @@ set(FLANG_ERRORING_FFLAGS
213218
-finit-logical=true
214219
-finit-real=inf
215220
-finline-functions
221+
-finline-intrinsics=maxloc
222+
-finline-intrinsics=minloc
216223
-finline-matmul-limit=0
217224
-finline-matmul-limit=10
218225
-finline-matmul-limit=100
@@ -228,6 +235,7 @@ set(FLANG_ERRORING_FFLAGS
228235
-flinker-output=nolto-rel
229236
-floop-interchange
230237
-fmax-array-constructor=100000
238+
-fmax-errors=1
231239
-fmax-stack-var-size=8
232240
-fmax-stack-var-size=100
233241
-fmodule-private
@@ -249,6 +257,8 @@ set(FLANG_ERRORING_FFLAGS
249257
-fno-inline
250258
-fno-inline-arg-packing
251259
-fno-inline-functions-called-once
260+
-fno-inline-intrinsics=maxloc
261+
-fno-inline-intrinsics=minloc
252262
-fno-ipa-cp
253263
-fno-ipa-icf
254264
-fno-ipa-modref
@@ -285,6 +295,7 @@ set(FLANG_ERRORING_FFLAGS
285295
-fno-tree-vrp
286296
-fnon-call-exceptions
287297
-fopenmp-simd
298+
-fopt-info-optimized-omp
288299
-fopt-info-vec-optimized
289300
-fpad-source
290301
-fpeel-loops
@@ -385,6 +396,7 @@ set(FLANG_ERRORING_FFLAGS
385396
-std=f2003
386397
-std=f2008
387398
-std=f2008ts
399+
-std=f202y
388400
# At the time of writing, -W warnings are not supported. flang errors out
389401
# saying that only -Werror is supported.
390402
-W
@@ -402,7 +414,9 @@ set(FLANG_ERRORING_FFLAGS
402414
-Wdate-time
403415
-Wdo-subscript
404416
-Werror
417+
-Wexternal-argument-mismatch
405418
-Wextra
419+
-Wfatal-errors
406420
-Wfunction-elimination
407421
-Wimplicit-interface
408422
-Wimplicit-procedure
@@ -431,10 +445,12 @@ set(FLANG_ERRORING_FFLAGS
431445
-Wno-missing-include-dirs
432446
-Wno-overwrite-recursive
433447
-Wno-pedantic
448+
-Wno-return-type
434449
-Wno-tabs
435450
-Wno-underflow
436451
-Wno-uninitialized
437452
-Wno-unused-dummy-argument
453+
-Wno-unused-variable
438454
-Wno-zerotrip
439455
-Wopenacc-parallelism
440456
-Wpadded
@@ -559,7 +575,7 @@ function(gfortran_check_test_config used_fort used_other)
559575
# files have been added or removed.
560576
foreach (f u IN ZIP_LISTS files used_fort)
561577
if (NOT f STREQUAL u)
562-
list(FIND used ${f} idx)
578+
list(FIND used_fort ${f} idx)
563579
if (idx EQUAL -1)
564580
message(FATAL_ERROR "${msg_unused}\n ${f}\n${msg_rerun}\n")
565581
else ()
@@ -793,16 +809,35 @@ function(gfortran_populate_tests)
793809
string(REPLACE " " ";" sources "${sources_t}")
794810
list(TRANSFORM sources PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)
795811

812+
# Multi-file tests consist of a "main" file and a number of (possibly
813+
# non-Fortran) dependents. This is the list of dependents.
814+
set(rest)
815+
796816
# The tests in the configuration must be added to the used list even if the
797817
# test is disabled because the sanity check will expect that the list of
798818
# Fortran files in the directory exactly matches the list of used Fortran
799819
# files.
800-
set(rest)
801820
list(LENGTH sources nsources)
802821
math(EXPR iend "${nsources} - 1")
803822
foreach (i RANGE ${iend})
804823
list(GET sources ${i} source)
805-
if (source MATCHES "^.+[.][Ff].*$")
824+
825+
# This is a clumsy workaround which probably warrants a cleaner fix. In
826+
# some cases, the dependent files are in a subdirectory of the current
827+
# source directory. If any such files are Fortran sources, the sanity
828+
# check in gfortran_check_test_config will fail because it only looks for
829+
# Fortran sources in the current source directory and ensures that the
830+
# list of those exactly match the list of Fortran source files that are
831+
# used in the test configurations. If we do encounter a situation like
832+
# this, simply ignore the Fortran source from the subdirectory. Ideally,
833+
# we should have a list of subdirectories into which we should recurse
834+
# in order to find used Fortran files. But for now, this workaround
835+
# will do.
836+
#
837+
# The source files have been prepended with ${CMAKE_CURRENT_SOURCE_DIR},
838+
# so take that into account when matching.
839+
if (source MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}/.+[/].+$")
840+
elseif (source MATCHES "^.+[.][Ff].*$")
806841
list(APPEND used_fort ${source})
807842
else ()
808843
list(APPEND used_other ${source})

Fortran/gfortran/regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_subdirectory(asan)
1818
add_subdirectory(c-interop)
1919
add_subdirectory(coarray)
2020
add_subdirectory(debug)
21+
add_subdirectory(f202y)
2122
add_subdirectory(g77)
2223
add_subdirectory(goacc)
2324
add_subdirectory(goacc-gomp)

Fortran/gfortran/regression/DisabledFiles.cmake

Lines changed: 96 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
286286
pr63331.f90
287287
submodule_26.f08
288288

289+
# unimplemented: dummy argument coarray in procedure interface
290+
complex_1.f90
291+
289292
# unimplemented: coarray reference
290293
coarray_lib_comm_1.f90
291294

@@ -297,6 +300,10 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
297300
# unimplemented: CriticalConstruct implementation
298301
coarray_2.f90
299302
coarray_critical_1.f90
303+
coarray_critical_3.f90
304+
305+
# unimplemented: FORM TEAM statement
306+
team_sync_2.f90
300307

301308
# unimplemented: SYNC IMAGES
302309
pr71706.f90
@@ -351,6 +358,10 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
351358
random_init_4.f90
352359
random_init_5.f90
353360
random_init_6.f90
361+
team_change_3.f90
362+
team_form_3.f90
363+
team_get_1.f90
364+
team_end_3.f90
354365

355366
# unimplemented: %VAL() intrinsic for arguments
356367
c_by_val_1.f
@@ -499,6 +510,10 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
499510
# supported in flang or some other reason. If there are multiple errors
500511
# in a single file, each distinct error message will be provided.
501512

513+
# error: ALLOCATABLE dummy argument 'arg=' must be associated with an
514+
# ALLOCATABLE actual argument
515+
class_transformational_1.f90
516+
502517
# error: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER
503518
# attribute
504519
ISO_Fortran_binding_15.f90
@@ -577,6 +592,7 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
577592
hollerith4.f90
578593
hollerith6.f90
579594
pdt_23.f03
595+
value_optional_2.f90
580596

581597
# error: Operands of .AND. must be LOGICAL; have 'TYPE 1' and 'TYPE 2'
582598
dec_bitwise_ops_1.f90
@@ -604,6 +620,8 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
604620
cray_pointers_7.f90
605621
dec_math.f90
606622
dec_math_5.f90
623+
f_c_string1.f90
624+
f_c_string2.f90
607625
fmt_g0_6.f08
608626
fmt_pf.f90
609627
interface_12.f90
@@ -626,6 +644,11 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
626644
# error: Actual argument for 'i=' has bad type 'LOGICAL(1)'
627645
and_or_xor.f90
628646

647+
# error: Actual argument for 'x=' has bad type 'UNSIGNED''
648+
out_of_range.f90
649+
out_of_range_2.f90
650+
out_of_range_3.f90
651+
629652
# error: Argument of ALLOCATED() must be an ALLOCATABLE object or component
630653
select_rank_1.f90
631654

@@ -767,6 +790,40 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
767790
# Consider using override.yaml to enable this test but expect different behavior
768791
coarray_lib_realloc_1.f90
769792

793+
# error: 'arith.constant' op integer return type must be signless
794+
# error: Lowering to LLVM IR failed
795+
# error: cannot be converted to LLVM IR: missing
796+
# `LLVMTranslationDialectInterface` registration for dialect for op: func.func
797+
unsigned_25.f90
798+
unsigned_26.f90
799+
unsigned_34.f90
800+
unsigned_35.f90
801+
802+
# error: Operands must not be UNSIGNED
803+
unsigned_43.f90
804+
unsigned_44.f90
805+
806+
# error: Substring must begin at 1 or later, not -1
807+
bounds_check_26.f90
808+
809+
# This test uses the makefile generation options -MT, -MD etc. which are
810+
# not yet supported.
811+
dependency_generation_1.f90
812+
813+
# error: BIND(C) procedure assembly name conflicts with non BIND(C) procedure
814+
# assembly name
815+
use_rename_14.f90
816+
817+
# ---------------------------------------------------------------------------
818+
#
819+
# These tests require REAL(kind=16) support. Currently, we do not determine
820+
# if this is available before enabling the test. Until we can do so
821+
# reliably, disable it everywhere.
822+
823+
pr82253.f90
824+
pr91497.f90
825+
nan_7.f90
826+
770827
# --------------------------------------------------------------------------
771828
#
772829
# These tests are skipped for a variety of reasons that don't fit well in
@@ -958,11 +1015,13 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
9581015
pad_source_3.f # depends on -fno-pad-source option
9591016
pad_source_4.f # depends on -ffixed-line-length-none option
9601017
pad_source_5.f # depends on -ffixed-line-length-0 option
1018+
pr119502.f90
9611019
pr12884.f
9621020
pr17286.f90
9631021
pr17706.f90 # depends on -fno-sign-zero option
9641022
pr59700.f90
9651023
pr71523_2.f90
1024+
pr88052.f90
9661025
pr96436_3.f90
9671026
pr96436_4.f90
9681027
pr96436_5.f90
@@ -997,6 +1056,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
9971056
recursive_check_13.f90
9981057
recursive_check_7.f90
9991058
recursive_check_9.f90
1059+
reduce_1.f90
10001060
round_3.f08
10011061
selected_kind_1.f90
10021062
short_circuiting_3.f90
@@ -1008,6 +1068,12 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
10081068
unf_read_corrupted_1.f90
10091069
unf_short_record_1.f90
10101070
unformatted_subrecord_1.f90
1071+
unsigned_2.f90
1072+
unsigned_21.f90
1073+
unsigned_22.f90
1074+
unsigned_30.f90
1075+
unsigned_4.f90
1076+
utf8_3.f03
10111077
widechar_IO_4.f90
10121078
zero_sized_1.f90
10131079
elemental_function_2.f90
@@ -1020,6 +1086,10 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
10201086
pointer_check_3.f90
10211087
pointer_check_4.f90
10221088

1089+
# This test fails with "STOP: code 2" when compiled with -O0, but passes at
1090+
# higher optimization levels.
1091+
pr117797.f90
1092+
10231093
# ---------------------------------------------------------------------------
10241094
#
10251095
# These tests are expected to raise a runtime error, but currently don't.
@@ -1050,14 +1120,33 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
10501120
#
10511121
# Compilation of these tests is expected to fail, but it succeeds instead.
10521122

1123+
allocate_error_8.f90
10531124
binding_label_tests_26b.f90
1125+
do_concurrent_12.f90
1126+
do_concurrent_15.f90
1127+
empty_derived_type_2.f90
1128+
interface_51.f90
1129+
interface_52.f90
1130+
proc_ptr_56.f90
10541131
test_common_binding_labels_2_main.f03
10551132
string_1.f90 # Expect error on 32 bits platform
1056-
volatile8.f90 # Gfortran expects compilation errors for invalid uses of volatile; flang
1057-
# supports one of these as an extension, and the others ought to either be warnings
1058-
# or errors. See the flang extensions document: "A non-definable actual argument,
1059-
# including the case of a vector subscript, may be associated with an ASYNCHRONOUS or VOLATILE dummy argument"
1060-
# llvm-project#137369
1133+
unsigned_16.f90
1134+
unsigned_37.f90
1135+
unsigned_38.f90
1136+
unsigned_41.f90
1137+
1138+
# This test seems to have been commented out entirely, and therefore
1139+
# compilation will succeed. However, there are still DejaGNU annotations in
1140+
# it, and one of them is xfail, so our framework registers this test as xfail.
1141+
initialization_25.f90
1142+
1143+
# Gfortran expects compilation errors for invalid uses of volatile; flang
1144+
# supports one of these as an extension, and the others ought to either be
1145+
# warnings or errors. See the flang extensions document: "A non-definable
1146+
# actual argument, including the case of a vector subscript, may be associated
1147+
# with an ASYNCHRONOUS or VOLATILE dummy argument"
1148+
# llvm-project#137369
1149+
volatile8.f90
10611150

10621151
# Tests that exercise gfortran's ability to set -std=f95 and then see errors on newer features
10631152
abstract_type_1.f90
@@ -1836,6 +1925,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
18361925
iso_fortran_env_9.f90
18371926
line_length_12.f90
18381927
oldstyle_5.f
1928+
out_of_range_1.f90
18391929
pdt_34.f03
18401930
pdt_35.f03
18411931
pr104555.f90
@@ -1851,6 +1941,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
18511941
selected_logical_kind_2.f90
18521942
submodule_3.f08
18531943
submodule_33.f08
1944+
unsigned_21_be.f90
18541945
achar_2.f90
18551946
allocate_with_source_30.f90
18561947
allocate_with_source_31.f90

Fortran/gfortran/regression/PR100914.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
! Fails on x86 targets where sizeof(long double) == 16.
22
! { dg-do run }
3-
! { dg-additional-sources PR100914.c }
43
! { dg-require-effective-target fortran_real_c_float128 }
4+
! { dg-additional-sources PR100914.c }
55
! { dg-additional-options "-Wno-pedantic" }
66
!
77
! Test the fix for PR100914
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
! { dg-do compile }
2+
!
3+
! PR fortran/114308 - reject array constructor value of abstract type
4+
5+
module my_module
6+
implicit none
7+
private
8+
9+
type, abstract, public :: a
10+
end type
11+
12+
type, extends(a), public :: b
13+
end type
14+
end
15+
16+
program main
17+
use my_module
18+
implicit none
19+
type(b) :: b_instance
20+
class(a), allocatable :: a_array(:)
21+
class(b), allocatable :: b_array(:)
22+
23+
a_array = [b_instance]
24+
b_array = [b_instance]
25+
a_array = [a_array] ! { dg-error "is of the ABSTRACT type" }
26+
a_array = [a_array(1)] ! { dg-error "is of the ABSTRACT type" }
27+
a_array = [a_array, b_instance] ! { dg-error "is of the ABSTRACT type" }
28+
a_array = [b_instance, a_array] ! { dg-error "is of the ABSTRACT type" }
29+
b_array = [b_array, a_array] ! { dg-error "is of the ABSTRACT type" }
30+
end program

0 commit comments

Comments
 (0)