public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "trnka at scm dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE Date: Tue, 31 Oct 2023 15:17:51 +0000 [thread overview] Message-ID: <bug-112316-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 Bug ID: 112316 Summary: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: trnka at scm dot com Target Milestone: --- Current releases/gcc-13 rejects the following testcase (compiled simply using gfortran -c test-bogus-pointer-arg-error.f90): ===== test-bogus-pointer-arg-error.f90 ===== module BogusPointerArgError implicit none type :: AType end type contains subroutine A () class(AType), allocatable :: x allocate(x) call B (x) end subroutine subroutine B (y) class(AType), intent(in) :: y end subroutine subroutine C (z) class(AType), intent(in) :: z(:) associate (xxx => z(1)) end associate end subroutine end module ========== 14 | call B (x) | 1 Error: Actual argument for ‘y’ at (1) must be a pointer or a valid target for the dummy pointer in a pointer assignment statement Apparently, both the associate block in C (which is never called) and routines A and B need to be present to trigger the issue. It also seems to only happen when "x" is polymorphic (class(AType)). A related testcase is also rejected, this time with an ICE: ===== test-ICE-get_descriptor_field.f90 ===== module AModule implicit none private public AType type, abstract :: AType contains generic, public :: assignment(=) => Assign procedure, private :: Assign end type AType contains subroutine Assign(lhs, rhs) class(AType), intent(inout) :: lhs class(AType), intent(in) :: rhs end subroutine end module AModule module ICEGetDescriptorField use AModule implicit none contains subroutine Foo (x) class(AType), intent(in) :: x(:) class(AType), allocatable :: y associate (xxx => x(1)) y = xxx end associate end subroutine end module ICEGetDescriptorField ========== test-ICE-get_descriptor_field.f90:38:16: 38 | y = xxx | 1 internal compiler error: in gfc_get_descriptor_field, at fortran/trans-array.cc:245 This time, AType needs to be in a separate module and have a defined assignment to trigger the bug. Both issues bisect to the following commit. Reverting this change on top of current releases/gcc-13 makes both issues go away. (GCC 14 is likely also affected, not tested.) https://gcc.gnu.org/g:d6997a5aab7aaa325946a6283bfee8ac2bd9f540 commit r13-7761-gd6997a5aab7aaa325946a6283bfee8ac2bd9f540 Author: Paul Thomas <pault@gcc.gnu.org> Date: Sun Aug 27 09:51:32 2023 +0100 Fortran: Fix some problems blocking associate meta-bug [PR87477]
next reply other threads:[~2023-10-31 15:17 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-31 15:17 trnka at scm dot com [this message] 2023-11-02 8:27 ` [Bug fortran/112316] [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE since r13-7761-gd6997a5aab7aaa325946a6283bfee8ac2bd9f540 rguenth at gcc dot gnu.org 2023-11-02 17:56 ` pault at gcc dot gnu.org 2023-11-02 22:23 ` cvs-commit at gcc dot gnu.org 2023-11-03 6:24 ` cvs-commit at gcc dot gnu.org 2023-11-03 6:29 ` pault at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112316-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).