From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 50E843858400; Tue, 31 Aug 2021 14:59:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50E843858400 From: "ripero84 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102145] New: TKR mismatches with -pedantic: -fallow-argument-mismatch does not degrade errors to warnings Date: Tue, 31 Aug 2021 14:59:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ripero84 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 14:59:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102145 Bug ID: 102145 Summary: TKR mismatches with -pedantic: -fallow-argument-mismatch does not degrade errors to warnings Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: ripero84 at gmail dot com Target Milestone: --- In the presence of -pedantic, -fallow-argument-mismatch fails to degrade the mismatch errors to warnings: $ cat pedt.f90=20 MODULE M IMPLICIT NONE EXTERNAL :: X CONTAINS SUBROUTINE S(A) COMPLEX :: A(*) CALL X(A) END SUBROUTINE T(A) REAL :: A(*) CALL X(A) END END $ gfortran pedt.f90 -c -o pedt.o -fallow-argument-mismatch # Expected warni= ng pedt.f90:8:11: 8 | CALL X(A) | 1 ...... 13 | CALL X(A) | 2 Warning: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(4)/REAL(4)). $ gfortran pedt.f90 -c -o pedt.o -fallow-argument-mismatch -pedantic # Unexpected error pedt.f90:8:11: 8 | CALL X(A) | 1 ...... 13 | CALL X(A) | 2 Error: Type mismatch between actual argument at (1) and actual argument at = (2) (COMPLEX(4)/REAL(4)). This is: - undocumented; and - unexpected, since it effectively means that by adding -pedantic to a compilation line that already contains -fallow-argument-mismatch, mismatch warnings are upgraded to errors, despite -pedantic is only supposed to issue warnings. It seems that GCC developers have known for years that -pedantic may change warnings to errors in the absence of error-raising flags (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D30929#c9), but it is still unclear to me whether this is undocumented or wrong behaviour. Note that there is evidence that -fallow-argument-mismatch is actually being processed: if the compiler finds multiple mismatches involving a given argument, it succeeds in only reporting one of them (as an error, not as the expected warning). I am seeking clarification about whether this is a bug (the combination of -pedantic -fallow-argument-mismatch flags should work differently / be forbidden), a documentation bug (in which case I would appreciate an explanation of the logic behind this, and an update to the documentation), = or both, and I would be grateful for the fix(/es). I am aware that -fallow-argument-mismatch is a hack that should be avoided,= but since users still need it, its behaviour and documentation should be at lea= st consistent. Note that this issue has already been reported by some Fortran codes: https://github.com/cp2k/cp2k/issues/1019, https://gitlab.com/siesta-project/siesta/-/issues/130 . This seems to affect all versions of gfortran since GCC 10. It would be ni= ce if any updates related to this were ported to the 10.x branch. Thank you for your help.=