Bug 2366511

Summary: Gfortran fails to compile standards compliant code when -Wall is enabled
Product: [Fedora] Fedora Reporter: Susi Lehtola <susi.lehtola>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 45CC: dmalcolm, fweimer, jakub, jlaw, josmyers, jwakely, mcermak, mpolacek, msebor, nickc, nixuser, sipoyare
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2366480    
Attachments:
Description Flags
Source code from dftd4 which exhibits the crash none

Description Susi Lehtola 2025-05-15 14:06:02 UTC
dftd4 and mctc-lib fail to compile in rawhide with gcc-gfortran-15.1.1-1.fc43 with an "Interface mismatch" error:

../app/argument.f90:114:53:

  114 |       call make_argument_list(new, argument_counter, argument_getter)
      |                                                     1
Error: Interface mismatch in dummy procedure ‘argument_getter’ at (1): ALLOCATABLE mismatch in argument '_formal_1'
../app/argument.f90:116:59:

  116 |       call make_argument_list(new, default_argument_count, get_default_argument)
      |                                                           1
Error: Interface mismatch in dummy procedure ‘argument_getter’ at (1): ALLOCATABLE mismatch in argument '_formal_1'


The codes in question use procedure pointers, which have been supported in at least four Fortran compilers for years. The error is only triggered when -Wall is present in the compiler flags.

<mock-chroot> sh-5.2# gfortran -c ../app/argument.f90
<mock-chroot> sh-5.2# gfortran -c -Wall ../app/argument.f90
../app/argument.f90:114:53:

  114 |       call make_argument_list(new, argument_counter, argument_getter)
      |                                                     1
Error: Interface mismatch in dummy procedure ‘argument_getter’ at (1): ALLOCATABLE mismatch in argument '_formal_1'
../app/argument.f90:116:59:

  116 |       call make_argument_list(new, default_argument_count, get_default_argument)
      |                                                           1
Error: Interface mismatch in dummy procedure ‘argument_getter’ at (1): ALLOCATABLE mismatch in argument '_formal_1'


I do not have a reduced test case, but the attached file from dftd4 is 364 lines and has no dependencies. The same codes compile in Fedora 41 and 40 without issues.

Reproducible: Always

Steps to Reproduce:
1. gfortran -c -Wall argument.f90

Actual Results:
Code does not compile

Expected Results:
Code compiles

Comment 1 Susi Lehtola 2025-05-15 14:06:45 UTC
Created attachment 2089964 [details]
Source code from dftd4 which exhibits the crash

Comment 2 Jonathan Wakely 2025-05-15 14:11:28 UTC
See https://gcc.gnu.org/gcc-15/changes.html#fortran

"The -Wexternal-arguments-mismatch option has been added. This checks for mismatches between the argument lists in dummy external arguments, and is implied by -Wall and -fc-prototypes-external options."

Comment 3 Aoife Moloney 2026-08-17 13:36:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 45 development cycle.
Changing version to 45.