Skip to content

Commit a3d689f

Browse files
authored
Fix failing tests with Intel compiler (#901)
* error #7976: An allocatable dummy argument may only be argument associated with an allocatable actual argument. [S] * enforce Fortran standard to enable LHS reallocation * fix empty args * fix input namelist formats * fix SEGFAULT building fpm_publish_settings * Revert "fix SEGFAULT building fpm_publish_settings" This reverts commit e0c86d6. * Revert "Revert "fix SEGFAULT building fpm_publish_settings"" This reverts commit aca4925. * Revert "fix empty args" This reverts commit 8f1a8f3. * fix test-manifest routine (segfault unallocated `flags`) * line too long * Revert "Revert "fix empty args"" This reverts commit 3d2907b. * Revert "Revert "Revert "fix SEGFAULT building fpm_publish_settings""" This reverts commit ff1e885. * make fpm_publish_settings work with both gfortran and intel * Update fpm_command_line.f90 * fix bus error returning string * fix unallocated variables in non-allocatable dummy arguments * fix more unallocated strings * check existing directory: intel compiler fix * fix join_path in dependency with root specified * more unallocated strings * fix ifort bug with extended `mock_dependency_tree_t`
1 parent 40b0c35 commit a3d689f

15 files changed

+201
-106
lines changed

src/fpm/dependency.f90

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -719,40 +719,45 @@ subroutine check_and_read_pkg_data(json, node, download_url, version, error)
719719

720720
integer :: code, stat
721721
type(json_object), pointer :: p, q
722-
character(:), allocatable :: version_key, version_str, error_message
722+
character(:), allocatable :: version_key, version_str, error_message, namespace, name
723+
724+
namespace = ""
725+
name = "UNNAMED_NODE"
726+
if (allocated(node%namespace)) namespace = node%namespace
727+
if (allocated(node%name)) name = node%name
723728

724729
if (.not. json%has_key('code')) then
725-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No status code."); return
730+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No status code."); return
726731
end if
727732

728733
call get_value(json, 'code', code, stat=stat)
729734
if (stat /= 0) then
730-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': "// &
735+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': "// &
731736
& "Failed to read status code."); return
732737
end if
733738

734739
if (code /= 200) then
735740
if (.not. json%has_key('message')) then
736-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No error message."); return
741+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No error message."); return
737742
end if
738743

739744
call get_value(json, 'message', error_message, stat=stat)
740745
if (stat /= 0) then
741-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': "// &
746+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': "// &
742747
& "Failed to read error message."); return
743748
end if
744749

745-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"'. Status code: '"// &
750+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"'. Status code: '"// &
746751
& str(code)//"'. Error message: '"//error_message//"'."); return
747752
end if
748753

749754
if (.not. json%has_key('data')) then
750-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No data."); return
755+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No data."); return
751756
end if
752757

753758
call get_value(json, 'data', p, stat=stat)
754759
if (stat /= 0) then
755-
call fatal_error(error, "Failed to read package data for '"//join_path(node%namespace, node%name)//"'."); return
760+
call fatal_error(error, "Failed to read package data for '"//join_path(namespace, name)//"'."); return
756761
end if
757762

758763
if (allocated(node%requested_version)) then
@@ -762,38 +767,38 @@ subroutine check_and_read_pkg_data(json, node, download_url, version, error)
762767
end if
763768

764769
if (.not. p%has_key(version_key)) then
765-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No version data."); return
770+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No version data."); return
766771
end if
767772

768773
call get_value(p, version_key, q, stat=stat)
769774
if (stat /= 0) then
770-
call fatal_error(error, "Failed to retrieve version data for '"//join_path(node%namespace, node%name)//"'."); return
775+
call fatal_error(error, "Failed to retrieve version data for '"//join_path(namespace, name)//"'."); return
771776
end if
772777

773778
if (.not. q%has_key('download_url')) then
774-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No download url."); return
779+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No download url."); return
775780
end if
776781

777782
call get_value(q, 'download_url', download_url, stat=stat)
778783
if (stat /= 0) then
779-
call fatal_error(error, "Failed to read download url for '"//join_path(node%namespace, node%name)//"'."); return
784+
call fatal_error(error, "Failed to read download url for '"//join_path(namespace, name)//"'."); return
780785
end if
781786

782787
download_url = official_registry_base_url//download_url
783788

784789
if (.not. q%has_key('version')) then
785-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No version found."); return
790+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No version found."); return
786791
end if
787792

788793
call get_value(q, 'version', version_str, stat=stat)
789794
if (stat /= 0) then
790-
call fatal_error(error, "Failed to read version data for '"//join_path(node%namespace, node%name)//"'."); return
795+
call fatal_error(error, "Failed to read version data for '"//join_path(namespace, name)//"'."); return
791796
end if
792797

793798
call new_version(version, version_str, error)
794799
if (allocated(error)) then
795800
call fatal_error(error, "'"//version_str//"' is not a valid version for '"// &
796-
& join_path(node%namespace, node%name)//"'."); return
801+
& join_path(namespace, name)//"'."); return
797802
end if
798803
end subroutine
799804

src/fpm/git.f90

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ module fpm_git
55
implicit none
66

77
public :: git_target_t, git_target_default, git_target_branch, git_target_tag, git_target_revision, git_revision, &
8-
& git_archive, git_matches_manifest, operator(==)
8+
& git_archive, git_matches_manifest, operator(==), compressed_package_name
9+
10+
!> Name of the compressed package that is generated temporarily.
11+
character(len=*), parameter :: compressed_package_name = 'compressed_package'
912

1013
!> Possible git target
1114
type :: enum_descriptor
@@ -162,6 +165,8 @@ logical function git_matches_manifest(cached,manifest,verbosity,iunit)
162165
!> while the cached dependency always stores a commit hash because it's built
163166
!> after the repo is available (saved as git_descriptor%revision==revision).
164167
!> So, comparing against the descriptor is not reliable
168+
git_matches_manifest = allocated(cached%object) .eqv. allocated(manifest%object)
169+
if (git_matches_manifest .and. allocated(cached%object)) &
165170
git_matches_manifest = cached%object == manifest%object
166171
if (.not.git_matches_manifest) then
167172
if (verbosity>1) write(iunit,out_fmt) "GIT OBJECT has changed: ",cached%object," vs. ", manifest%object

src/fpm/manifest/dependency.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module fpm_manifest_dependency
2727
use fpm_git, only: git_target_t, git_target_tag, git_target_branch, &
2828
& git_target_revision, git_target_default, operator(==), git_matches_manifest
2929
use fpm_toml, only: toml_table, toml_key, toml_stat, get_value, check_keys
30-
use fpm_filesystem, only: windows_path
30+
use fpm_filesystem, only: windows_path, join_path
3131
use fpm_environment, only: get_os_type, OS_WINDOWS
3232
use fpm_versioning, only: version_t, new_version
3333
implicit none
@@ -94,7 +94,7 @@ subroutine new_dependency(self, table, root, error)
9494
call get_value(table, "path", uri)
9595
if (allocated(uri)) then
9696
if (get_os_type() == OS_WINDOWS) uri = windows_path(uri)
97-
if (present(root)) uri = root//uri ! Relative to the fpm.toml it’s written in
97+
if (present(root)) uri = join_path(root,uri) ! Relative to the fpm.toml it’s written in
9898
call move_alloc(uri, self%path)
9999
return
100100
end if

src/fpm/manifest/profiles.f90

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module fpm_manifest_profile
5353
& info_profile, find_profile, DEFAULT_COMPILER
5454

5555
!> Name of the default compiler
56-
character(len=*), parameter :: DEFAULT_COMPILER = 'gfortran'
56+
character(len=*), parameter :: DEFAULT_COMPILER = 'gfortran'
5757
integer, parameter :: OS_ALL = -1
5858
character(len=:), allocatable :: path
5959

@@ -78,7 +78,7 @@ module fpm_manifest_profile
7878

7979
!> Value repesenting OS
8080
integer :: os_type
81-
81+
8282
!> Fortran compiler flags
8383
character(len=:), allocatable :: flags
8484

@@ -110,16 +110,16 @@ module fpm_manifest_profile
110110
function new_profile(profile_name, compiler, os_type, flags, c_flags, cxx_flags, &
111111
link_time_flags, file_scope_flags, is_built_in) &
112112
& result(profile)
113-
113+
114114
!> Name of the profile
115115
character(len=*), intent(in) :: profile_name
116-
116+
117117
!> Name of the compiler
118118
character(len=*), intent(in) :: compiler
119-
119+
120120
!> Type of the OS
121121
integer, intent(in) :: os_type
122-
122+
123123
!> Fortran compiler flags
124124
character(len=*), optional, intent(in) :: flags
125125

@@ -190,7 +190,7 @@ subroutine validate_compiler_name(compiler_name, is_valid)
190190
is_valid = .false.
191191
end select
192192
end subroutine validate_compiler_name
193-
193+
194194
!> Check if os_name is a valid name of a supported OS
195195
subroutine validate_os_name(os_name, is_valid)
196196

@@ -373,10 +373,10 @@ subroutine get_flags(profile_name, compiler_name, os_type, key_list, table, prof
373373
& flags, c_flags, cxx_flags, link_time_flags, file_scope_flags)
374374
profindex = profindex + 1
375375
end subroutine get_flags
376-
376+
377377
!> Traverse operating system tables to obtain number of profiles
378378
subroutine traverse_oss_for_size(profile_name, compiler_name, os_list, table, profiles_size, error)
379-
379+
380380
!> Name of profile
381381
character(len=:), allocatable, intent(in) :: profile_name
382382

@@ -447,7 +447,7 @@ end subroutine traverse_oss_for_size
447447

448448
!> Traverse operating system tables to obtain profiles
449449
subroutine traverse_oss(profile_name, compiler_name, os_list, table, profiles, profindex, error)
450-
450+
451451
!> Name of profile
452452
character(len=:), allocatable, intent(in) :: profile_name
453453

@@ -468,7 +468,7 @@ subroutine traverse_oss(profile_name, compiler_name, os_list, table, profiles, p
468468

469469
!> Index in the list of profiles
470470
integer, intent(inout) :: profindex
471-
471+
472472
type(toml_key), allocatable :: key_list(:)
473473
character(len=:), allocatable :: os_name, l_os_name
474474
type(toml_table), pointer :: os_node
@@ -513,7 +513,7 @@ end subroutine traverse_oss
513513

514514
!> Traverse compiler tables
515515
subroutine traverse_compilers(profile_name, comp_list, table, error, profiles_size, profiles, profindex)
516-
516+
517517
!> Name of profile
518518
character(len=:), allocatable, intent(in) :: profile_name
519519

@@ -522,10 +522,10 @@ subroutine traverse_compilers(profile_name, comp_list, table, error, profiles_si
522522

523523
!> Table containing compiler tables
524524
type(toml_table), pointer, intent(in) :: table
525-
525+
526526
!> Error handling
527527
type(error_t), allocatable, intent(out) :: error
528-
528+
529529
!> Number of profiles in list of profiles
530530
integer, intent(inout), optional :: profiles_size
531531

@@ -534,8 +534,8 @@ subroutine traverse_compilers(profile_name, comp_list, table, error, profiles_si
534534

535535
!> Index in the list of profiles
536536
integer, intent(inout), optional :: profindex
537-
538-
character(len=:), allocatable :: compiler_name
537+
538+
character(len=:), allocatable :: compiler_name
539539
type(toml_table), pointer :: comp_node
540540
type(toml_key), allocatable :: os_list(:)
541541
integer :: icomp, stat
@@ -544,7 +544,7 @@ subroutine traverse_compilers(profile_name, comp_list, table, error, profiles_si
544544
if (size(comp_list)<1) return
545545
do icomp = 1, size(comp_list)
546546
call validate_compiler_name(comp_list(icomp)%key, is_valid)
547-
if (is_valid) then
547+
if (is_valid) then
548548
compiler_name = comp_list(icomp)%key
549549
call get_value(table, compiler_name, comp_node, stat=stat)
550550
if (stat /= toml_stat%success) then
@@ -567,7 +567,7 @@ subroutine traverse_compilers(profile_name, comp_list, table, error, profiles_si
567567
else
568568
call fatal_error(error,'*traverse_compilers*:Error: Compiler name not specified or invalid.')
569569
end if
570-
end do
570+
end do
571571
end subroutine traverse_compilers
572572

573573
!> Construct new profiles array from a TOML data structure
@@ -596,9 +596,9 @@ subroutine new_profiles(profiles, table, error)
596596
default_profiles = get_default_profiles(error)
597597
if (allocated(error)) return
598598
call table%get_keys(prof_list)
599-
599+
600600
if (size(prof_list) < 1) return
601-
601+
602602
profiles_size = 0
603603

604604
do iprof = 1, size(prof_list)
@@ -633,7 +633,7 @@ subroutine new_profiles(profiles, table, error)
633633

634634
profiles_size = profiles_size + size(default_profiles)
635635
allocate(profiles(profiles_size))
636-
636+
637637
do profindex=1, size(default_profiles)
638638
profiles(profindex) = default_profiles(profindex)
639639
end do
@@ -719,25 +719,25 @@ function get_default_profiles(error) result(default_profiles)
719719
& 'ifort', &
720720
& OS_ALL, &
721721
& flags = ' -fp-model precise -pc64 -align all -error-limit 1 -reentrancy&
722-
& threaded -nogen-interfaces -assume byterecl', &
722+
& threaded -nogen-interfaces -assume byterecl -standard-semantics', &
723723
& is_built_in=.true.), &
724724
& new_profile('release', &
725725
& 'ifort', &
726726
& OS_WINDOWS, &
727727
& flags = ' /fp:precise /align:all /error-limit:1 /reentrancy:threaded&
728-
& /nogen-interfaces /assume:byterecl', &
728+
& /nogen-interfaces /assume:byterecl /standard-semantics', &
729729
& is_built_in=.true.), &
730730
& new_profile('release', &
731731
& 'ifx', &
732732
& OS_ALL, &
733733
& flags = ' -fp-model=precise -pc64 -align all -error-limit 1 -reentrancy&
734-
& threaded -nogen-interfaces -assume byterecl', &
734+
& threaded -nogen-interfaces -assume byterecl -standard-semantics', &
735735
& is_built_in=.true.), &
736736
& new_profile('release', &
737737
& 'ifx', &
738738
& OS_WINDOWS, &
739739
& flags = ' /fp:precise /align:all /error-limit:1 /reentrancy:threaded&
740-
& /nogen-interfaces /assume:byterecl', &
740+
& /nogen-interfaces /assume:byterecl /standard-semantics', &
741741
& is_built_in=.true.), &
742742
& new_profile('release', &
743743
&'nagfor', &
@@ -775,28 +775,28 @@ function get_default_profiles(error) result(default_profiles)
775775
& new_profile('debug', &
776776
& 'ifort', &
777777
& OS_ALL, &
778-
& flags = ' -warn all -check all -error-limit 1 -O0 -g -assume byterecl -traceback', &
778+
& flags = ' -warn all -check all -error-limit 1 -O0 -g -assume byterecl -standard-semantics -traceback', &
779779
& is_built_in=.true.), &
780780
& new_profile('debug', &
781781
& 'ifort', &
782782
& OS_WINDOWS, &
783783
& flags = ' /warn:all /check:all /error-limit:1&
784-
& /Od /Z7 /assume:byterecl /traceback', &
784+
& /Od /Z7 /assume:byterecl /standard-semantics /traceback', &
785785
& is_built_in=.true.), &
786786
& new_profile('debug', &
787787
& 'ifx', &
788788
& OS_ALL, &
789-
& flags = ' -warn all -check all -error-limit 1 -O0 -g -assume byterecl -traceback', &
789+
& flags = ' -warn all -check all -error-limit 1 -O0 -g -assume byterecl -standard-semantics -traceback', &
790790
& is_built_in=.true.), &
791791
& new_profile('debug', &
792792
& 'ifx', &
793793
& OS_WINDOWS, &
794-
& flags = ' /warn:all /check:all /error-limit:1 /Od /Z7 /assume:byterecl', &
794+
& flags = ' /warn:all /check:all /error-limit:1 /Od /Z7 /assume:byterecl /standard-semantics', &
795795
& is_built_in=.true.), &
796796
& new_profile('debug', &
797797
& 'ifx', &
798798
& OS_WINDOWS, &
799-
& flags = ' /warn:all /check:all /error-limit:1 /Od /Z7 /assume:byterecl', &
799+
& flags = ' /warn:all /check:all /error-limit:1 /Od /Z7 /assume:byterecl /standard-semantics', &
800800
& is_built_in=.true.), &
801801
& new_profile('debug', &
802802
& 'lfortran', &

src/fpm_command_line.f90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,9 @@ subroutine get_command_line_settings(cmd_settings)
218218
integer :: os
219219
logical :: is_unix
220220
type(fpm_install_settings), allocatable :: install_settings
221-
type(fpm_publish_settings), allocatable :: publish_settings
222221
type(version_t) :: version
223222
character(len=:), allocatable :: common_args, compiler_args, run_args, working_dir, &
224-
& c_compiler, cxx_compiler, archiver, version_s
223+
& c_compiler, cxx_compiler, archiver, version_s, token_s
225224

226225
character(len=*), parameter :: fc_env = "FC", cc_env = "CC", ar_env = "AR", &
227226
& fflags_env = "FFLAGS", cflags_env = "CFLAGS", cxxflags_env = "CXXFLAGS", ldflags_env = "LDFLAGS", &
@@ -633,8 +632,10 @@ subroutine get_command_line_settings(cmd_settings)
633632
c_compiler = sget('c-compiler')
634633
cxx_compiler = sget('cxx-compiler')
635634
archiver = sget('archiver')
635+
token_s = sget('token')
636636

637-
allocate(publish_settings, source=fpm_publish_settings( &
637+
allocate(fpm_publish_settings :: cmd_settings)
638+
cmd_settings = fpm_publish_settings( &
638639
& show_package_version = lget('show-package-version'), &
639640
& show_form_data = lget('show-form-data'), &
640641
& profile=val_profile,&
@@ -650,9 +651,8 @@ subroutine get_command_line_settings(cmd_settings)
650651
& list=lget('list'),&
651652
& show_model=lget('show-model'),&
652653
& build_tests=lget('tests'),&
653-
& verbose=lget('verbose')))
654-
call get_char_arg(publish_settings%token, 'token')
655-
call move_alloc(publish_settings, cmd_settings)
654+
& verbose=lget('verbose'),&
655+
& token=token_s)
656656

657657
case default
658658

0 commit comments

Comments
 (0)