Skip to content

fpm testsuite crashes at runtime if built with -fcheck=all  #844

@perazz

Description

@perazz

Description

If the fpm testsuite is compiled with gfortran's -fcheck=all flag, several runtime allocation errors arise from the dependency checking testsuite:

# Testing: fpm_module_dependencies
# Starting library-module-use ... (1/15)
At line 819 of file /Users/federico/Documents/GitHub/fpm/src/fpm_targets.f90
Fortran runtime error: Allocatable actual argument 'model' is not allocated

Error termination. Backtrace:

The reason is that some routines e.g. add_target have non-allocated allocatable variables of model in non-optional dummy arguments:

fpm/src/fpm_targets.f90

Lines 247 to 251 in 5efb9e0

call add_target(targets,package=model%packages(j)%name,source = sources(i), &
type = FPM_TARGET_CPP_OBJECT, &
output_name = get_object_name(sources(i)), &
macros = model%packages(j)%macros, &
version = model%packages(j)%version)

fpm/src/fpm_targets.f90

Lines 400 to 408 in 5efb9e0

subroutine add_target(targets,package,type,output_name,source,link_libraries, macros, version)
type(build_target_ptr), allocatable, intent(inout) :: targets(:)
character(*), intent(in) :: package
integer, intent(in) :: type
character(*), intent(in) :: output_name
type(srcfile_t), intent(in), optional :: source
type(string_t), intent(in), optional :: link_libraries(:)
type(string_t), intent(in), optional :: macros(:)
character(*), intent(in), optional :: version

Expected Behaviour

Should not crash

Version of fpm

0.7.0

Platform and Architecture

MacOS

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions