Skip to content

[Fortran/gfortran] Sync gfortran tests with upstream #241

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 38 additions & 3 deletions Fortran/gfortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ set(FLANG_ERRORING_FFLAGS
-fdefault-real-10
-fdefault-real-16
-fdiagnostics-format=json
-fdiagnostics-format=json-stderr
-fdiagnostics-format=sarif-file
-fdiagnostics-show-option
-fdollar-ok
-fdump-fortran-original
Expand All @@ -158,12 +160,15 @@ set(FLANG_ERRORING_FFLAGS
-fdump-tree-fre1
-fdump-tree-gimple
-fdump-tree-ifcvt
-fdump-tree-ivopts-all
-fdump-tree-ldist-all
-fdump-tree-ldist-details
-fdump-tree-lim2
-fdump-tree-lim2-details
-fdump-tree-linterchange-details
-fdump-tree-lversion-details
-fdump-tree-ompdevlow
-fdump-tree-ompexp
-fdump-tree-omplower
-fdump-tree-optimized
-fdump-tree-optimized-raw
Expand Down Expand Up @@ -213,6 +218,8 @@ set(FLANG_ERRORING_FFLAGS
-finit-logical=true
-finit-real=inf
-finline-functions
-finline-intrinsics=maxloc
-finline-intrinsics=minloc
-finline-matmul-limit=0
-finline-matmul-limit=10
-finline-matmul-limit=100
Expand All @@ -228,6 +235,7 @@ set(FLANG_ERRORING_FFLAGS
-flinker-output=nolto-rel
-floop-interchange
-fmax-array-constructor=100000
-fmax-errors=1
-fmax-stack-var-size=8
-fmax-stack-var-size=100
-fmodule-private
Expand All @@ -249,6 +257,8 @@ set(FLANG_ERRORING_FFLAGS
-fno-inline
-fno-inline-arg-packing
-fno-inline-functions-called-once
-fno-inline-intrinsics=maxloc
-fno-inline-intrinsics=minloc
-fno-ipa-cp
-fno-ipa-icf
-fno-ipa-modref
Expand Down Expand Up @@ -285,6 +295,7 @@ set(FLANG_ERRORING_FFLAGS
-fno-tree-vrp
-fnon-call-exceptions
-fopenmp-simd
-fopt-info-optimized-omp
-fopt-info-vec-optimized
-fpad-source
-fpeel-loops
Expand Down Expand Up @@ -385,6 +396,7 @@ set(FLANG_ERRORING_FFLAGS
-std=f2003
-std=f2008
-std=f2008ts
-std=f202y
# At the time of writing, -W warnings are not supported. flang errors out
# saying that only -Werror is supported.
-W
Expand All @@ -402,7 +414,9 @@ set(FLANG_ERRORING_FFLAGS
-Wdate-time
-Wdo-subscript
-Werror
-Wexternal-argument-mismatch
-Wextra
-Wfatal-errors
-Wfunction-elimination
-Wimplicit-interface
-Wimplicit-procedure
Expand Down Expand Up @@ -431,10 +445,12 @@ set(FLANG_ERRORING_FFLAGS
-Wno-missing-include-dirs
-Wno-overwrite-recursive
-Wno-pedantic
-Wno-return-type
-Wno-tabs
-Wno-underflow
-Wno-uninitialized
-Wno-unused-dummy-argument
-Wno-unused-variable
-Wno-zerotrip
-Wopenacc-parallelism
-Wpadded
Expand Down Expand Up @@ -559,7 +575,7 @@ function(gfortran_check_test_config used_fort used_other)
# files have been added or removed.
foreach (f u IN ZIP_LISTS files used_fort)
if (NOT f STREQUAL u)
list(FIND used ${f} idx)
list(FIND used_fort ${f} idx)
if (idx EQUAL -1)
message(FATAL_ERROR "${msg_unused}\n ${f}\n${msg_rerun}\n")
else ()
Expand Down Expand Up @@ -793,16 +809,35 @@ function(gfortran_populate_tests)
string(REPLACE " " ";" sources "${sources_t}")
list(TRANSFORM sources PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)

# Multi-file tests consist of a "main" file and a number of (possibly
# non-Fortran) dependents. This is the list of dependents.
set(rest)

# The tests in the configuration must be added to the used list even if the
# test is disabled because the sanity check will expect that the list of
# Fortran files in the directory exactly matches the list of used Fortran
# files.
set(rest)
list(LENGTH sources nsources)
math(EXPR iend "${nsources} - 1")
foreach (i RANGE ${iend})
list(GET sources ${i} source)
if (source MATCHES "^.+[.][Ff].*$")

# This is a clumsy workaround which probably warrants a cleaner fix. In
# some cases, the dependent files are in a subdirectory of the current
# source directory. If any such files are Fortran sources, the sanity
# check in gfortran_check_test_config will fail because it only looks for
# Fortran sources in the current source directory and ensures that the
# list of those exactly match the list of Fortran source files that are
# used in the test configurations. If we do encounter a situation like
# this, simply ignore the Fortran source from the subdirectory. Ideally,
# we should have a list of subdirectories into which we should recurse
# in order to find used Fortran files. But for now, this workaround
# will do.
#
# The source files have been prepended with ${CMAKE_CURRENT_SOURCE_DIR},
# so take that into account when matching.
if (source MATCHES "^${CMAKE_CURRENT_SOURCE_DIR}/.+[/].+$")
elseif (source MATCHES "^.+[.][Ff].*$")
list(APPEND used_fort ${source})
else ()
list(APPEND used_other ${source})
Expand Down
1 change: 1 addition & 0 deletions Fortran/gfortran/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_subdirectory(asan)
add_subdirectory(c-interop)
add_subdirectory(coarray)
add_subdirectory(debug)
add_subdirectory(f202y)
add_subdirectory(g77)
add_subdirectory(goacc)
add_subdirectory(goacc-gomp)
Expand Down
101 changes: 96 additions & 5 deletions Fortran/gfortran/regression/DisabledFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
pr63331.f90
submodule_26.f08

# unimplemented: dummy argument coarray in procedure interface
complex_1.f90

# unimplemented: coarray reference
coarray_lib_comm_1.f90

Expand All @@ -297,6 +300,10 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
# unimplemented: CriticalConstruct implementation
coarray_2.f90
coarray_critical_1.f90
coarray_critical_3.f90

# unimplemented: FORM TEAM statement
team_sync_2.f90

# unimplemented: SYNC IMAGES
pr71706.f90
Expand Down Expand Up @@ -351,6 +358,10 @@ file(GLOB UNIMPLEMENTED_FILES CONFIGURE_DEPENDS
random_init_4.f90
random_init_5.f90
random_init_6.f90
team_change_3.f90
team_form_3.f90
team_get_1.f90
team_end_3.f90

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

# error: ALLOCATABLE dummy argument 'arg=' must be associated with an
# ALLOCATABLE actual argument
class_transformational_1.f90

# error: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER
# attribute
ISO_Fortran_binding_15.f90
Expand Down Expand Up @@ -577,6 +592,7 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
hollerith4.f90
hollerith6.f90
pdt_23.f03
value_optional_2.f90

# error: Operands of .AND. must be LOGICAL; have 'TYPE 1' and 'TYPE 2'
dec_bitwise_ops_1.f90
Expand Down Expand Up @@ -604,6 +620,8 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
cray_pointers_7.f90
dec_math.f90
dec_math_5.f90
f_c_string1.f90
f_c_string2.f90
fmt_g0_6.f08
fmt_pf.f90
interface_12.f90
Expand All @@ -626,6 +644,11 @@ file(GLOB SKIPPED_FILES CONFIGURE_DEPENDS
# error: Actual argument for 'i=' has bad type 'LOGICAL(1)'
and_or_xor.f90

# error: Actual argument for 'x=' has bad type 'UNSIGNED''
out_of_range.f90
out_of_range_2.f90
out_of_range_3.f90

# error: Argument of ALLOCATED() must be an ALLOCATABLE object or component
select_rank_1.f90

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

# error: 'arith.constant' op integer return type must be signless
# error: Lowering to LLVM IR failed
# error: cannot be converted to LLVM IR: missing
# `LLVMTranslationDialectInterface` registration for dialect for op: func.func
unsigned_25.f90
unsigned_26.f90
unsigned_34.f90
unsigned_35.f90

# error: Operands must not be UNSIGNED
unsigned_43.f90
unsigned_44.f90

# error: Substring must begin at 1 or later, not -1
bounds_check_26.f90

# This test uses the makefile generation options -MT, -MD etc. which are
# not yet supported.
dependency_generation_1.f90

# error: BIND(C) procedure assembly name conflicts with non BIND(C) procedure
# assembly name
use_rename_14.f90

# ---------------------------------------------------------------------------
#
# These tests require REAL(kind=16) support. Currently, we do not determine
# if this is available before enabling the test. Until we can do so
# reliably, disable it everywhere.

pr82253.f90
pr91497.f90
nan_7.f90

# --------------------------------------------------------------------------
#
# These tests are skipped for a variety of reasons that don't fit well in
Expand Down Expand Up @@ -958,11 +1015,13 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
pad_source_3.f # depends on -fno-pad-source option
pad_source_4.f # depends on -ffixed-line-length-none option
pad_source_5.f # depends on -ffixed-line-length-0 option
pr119502.f90
pr12884.f
pr17286.f90
pr17706.f90 # depends on -fno-sign-zero option
pr59700.f90
pr71523_2.f90
pr88052.f90
pr96436_3.f90
pr96436_4.f90
pr96436_5.f90
Expand Down Expand Up @@ -997,6 +1056,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
recursive_check_13.f90
recursive_check_7.f90
recursive_check_9.f90
reduce_1.f90
round_3.f08
selected_kind_1.f90
short_circuiting_3.f90
Expand All @@ -1008,6 +1068,12 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
unf_read_corrupted_1.f90
unf_short_record_1.f90
unformatted_subrecord_1.f90
unsigned_2.f90
unsigned_21.f90
unsigned_22.f90
unsigned_30.f90
unsigned_4.f90
utf8_3.f03
widechar_IO_4.f90
zero_sized_1.f90
elemental_function_2.f90
Expand All @@ -1020,6 +1086,10 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
pointer_check_3.f90
pointer_check_4.f90

# This test fails with "STOP: code 2" when compiled with -O0, but passes at
# higher optimization levels.
pr117797.f90

# ---------------------------------------------------------------------------
#
# These tests are expected to raise a runtime error, but currently don't.
Expand Down Expand Up @@ -1050,14 +1120,33 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
#
# Compilation of these tests is expected to fail, but it succeeds instead.

allocate_error_8.f90
binding_label_tests_26b.f90
do_concurrent_12.f90
do_concurrent_15.f90
empty_derived_type_2.f90
interface_51.f90
interface_52.f90
proc_ptr_56.f90
test_common_binding_labels_2_main.f03
string_1.f90 # Expect error on 32 bits platform
volatile8.f90 # Gfortran expects compilation errors for invalid uses of volatile; flang
# supports one of these as an extension, and the others ought to either be warnings
# or errors. See the flang extensions document: "A non-definable actual argument,
# including the case of a vector subscript, may be associated with an ASYNCHRONOUS or VOLATILE dummy argument"
# llvm-project#137369
unsigned_16.f90
unsigned_37.f90
unsigned_38.f90
unsigned_41.f90

# This test seems to have been commented out entirely, and therefore
# compilation will succeed. However, there are still DejaGNU annotations in
# it, and one of them is xfail, so our framework registers this test as xfail.
initialization_25.f90

# Gfortran expects compilation errors for invalid uses of volatile; flang
# supports one of these as an extension, and the others ought to either be
# warnings or errors. See the flang extensions document: "A non-definable
# actual argument, including the case of a vector subscript, may be associated
# with an ASYNCHRONOUS or VOLATILE dummy argument"
# llvm-project#137369
volatile8.f90

# Tests that exercise gfortran's ability to set -std=f95 and then see errors on newer features
abstract_type_1.f90
Expand Down Expand Up @@ -1836,6 +1925,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
iso_fortran_env_9.f90
line_length_12.f90
oldstyle_5.f
out_of_range_1.f90
pdt_34.f03
pdt_35.f03
pr104555.f90
Expand All @@ -1851,6 +1941,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS
selected_logical_kind_2.f90
submodule_3.f08
submodule_33.f08
unsigned_21_be.f90
achar_2.f90
allocate_with_source_30.f90
allocate_with_source_31.f90
Expand Down
2 changes: 1 addition & 1 deletion Fortran/gfortran/regression/PR100914.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! Fails on x86 targets where sizeof(long double) == 16.
! { dg-do run }
! { dg-additional-sources PR100914.c }
! { dg-require-effective-target fortran_real_c_float128 }
! { dg-additional-sources PR100914.c }
! { dg-additional-options "-Wno-pedantic" }
!
! Test the fix for PR100914
Expand Down
30 changes: 30 additions & 0 deletions Fortran/gfortran/regression/abstract_type_10.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
! { dg-do compile }
!
! PR fortran/114308 - reject array constructor value of abstract type

module my_module
implicit none
private

type, abstract, public :: a
end type

type, extends(a), public :: b
end type
end

program main
use my_module
implicit none
type(b) :: b_instance
class(a), allocatable :: a_array(:)
class(b), allocatable :: b_array(:)

a_array = [b_instance]
b_array = [b_instance]
a_array = [a_array] ! { dg-error "is of the ABSTRACT type" }
a_array = [a_array(1)] ! { dg-error "is of the ABSTRACT type" }
a_array = [a_array, b_instance] ! { dg-error "is of the ABSTRACT type" }
a_array = [b_instance, a_array] ! { dg-error "is of the ABSTRACT type" }
b_array = [b_array, a_array] ! { dg-error "is of the ABSTRACT type" }
end program
Loading