public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE @ 2023-10-31 15:17 trnka at scm dot com 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 ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: trnka at scm dot com @ 2023-10-31 15:17 UTC (permalink / raw) To: gcc-bugs 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] ^ permalink raw reply [flat|nested] 6+ messages in thread
* [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 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com @ 2023-11-02 8:27 ` rguenth at gcc dot gnu.org 2023-11-02 17:56 ` pault at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-11-02 8:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Priority|P3 |P4 Target Milestone|--- |13.3 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [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 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com 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 ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pault at gcc dot gnu.org @ 2023-11-02 17:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-11-02 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- I can confirm this bug, of course. Thanks for the report. I temporary work around is to invert the order of the contained procedures. The problem is caused by a stupid (on my part :-( ) oversight: diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index e103ebee557..f88f9be3be8 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -5196,7 +5196,7 @@ parse_associate (void) } } - if (target->rank) + if (1) { int rank = 0; rank = target->rank; fixes the problem and regtests OK. The simplification that I effected with the offending patch has been completely spoiled by forgetting that one of the cases that was supposed to be fixed in the block following the condition above is that of target->rank = 0 and the associate variable having an array_spec. I will commit a cleaned up version as obvious first thing tomorrow morning. Sorry for the inconvenience. Paul ^ permalink raw reply [flat|nested] 6+ messages in thread
* [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 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com 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 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-11-02 22:23 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 --- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>: https://gcc.gnu.org/g:7c1d011bc1f8b26dba4ebcbd4a429628dfb2698d commit r14-5088-g7c1d011bc1f8b26dba4ebcbd4a429628dfb2698d Author: Paul Thomas <pault@gcc.gnu.org> Date: Thu Nov 2 22:23:05 2023 +0000 Fortran: Fix for regression in ASSOCIATE [PR112316] 2023-11-02 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/112316 * parse.cc (parse_associate): Remove condition that caused this regression. gcc/testsuite/ PR fortran/112316 * gfortran.dg/pr112316.f90: New test. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [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 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com ` (2 preceding siblings ...) 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 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-11-03 6:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Paul Thomas <pault@gcc.gnu.org>: https://gcc.gnu.org/g:79fc5916f04d9cd6f46b140bc8bbeb2b2eacd2ff commit r13-8000-g79fc5916f04d9cd6f46b140bc8bbeb2b2eacd2ff Author: Paul Thomas <pault@gcc.gnu.org> Date: Thu Nov 2 22:23:05 2023 +0000 Fortran: Fix for regression in ASSOCIATE [PR112316] 2023-11-02 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/112316 * parse.cc (parse_associate): Remove condition that caused this regression. gcc/testsuite/ PR fortran/112316 * gfortran.dg/pr112316.f90: New test. (cherry picked from commit 7c1d011bc1f8b26dba4ebcbd4a429628dfb2698d) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [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 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com ` (3 preceding siblings ...) 2023-11-03 6:24 ` cvs-commit at gcc dot gnu.org @ 2023-11-03 6:29 ` pault at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pault at gcc dot gnu.org @ 2023-11-03 6:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112316 Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> --- Fixed on 13-branch and on mainline. Once again, thanks for the report and apologies for the inconvenience. Paul ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-03 6:29 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-10-31 15:17 [Bug fortran/112316] New: [13 Regression] Fix for PR87477 rejects valid code with a bogus error about pointer assignment and causes an ICE trnka at scm dot com 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
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).