public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109948] [13/14 Regression] ICE(segfault) in gfc_expression_rank() from gfc_op_rank_conformable() Date: Wed, 31 May 2023 17:11:25 +0000 [thread overview] Message-ID: <bug-109948-4-LotxKhOINH@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109948-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109948 Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #15 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 55225 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55225&action=edit Fix for this PR The attached patch substantially tidies up parse_associate and fixes: ! { dg-do run } ! ! Tests the fix for PR109948 ! module mm implicit none interface operator(==) module procedure eq_1_2 end interface operator(==) private :: eq_1_2 contains logical function eq_1_2 (x, y) integer, intent(in) :: x(:) real, intent(in) :: y(:,:) eq_1_2 = .true. end function eq_1_2 end module mm program pr109948 use mm implicit none type tlap integer, allocatable :: z(:) end type tlap type ulap type(tlap) :: u(2) end type ulap integer :: pid = 1 call comment0 ! Original problem call comment1 call comment3 ([5,4,3,2,1]) call comment10 call comment11 ([5,4,3,2,1]) contains subroutine comment0 type(tlap) :: y_in integer :: x_out(3) =[0.0,0.0,0.0] y_in%z = [1,-2,3] call foo(y_in, x_out) if (any (x_out .ne. [0, -2, 0])) stop 1 call foo(y_in, x_out) if (any (x_out .ne. [1, -2, 3])) stop 2 end subroutine comment0 subroutine foo(y, x) type(tlap) :: y integer :: x(:) associate(z=>y%z) if (pid == 1) then where ( z < 0 ) x(:) = z(:) else where ( z > 0 ) x(:) = z(:) endif pid = pid + 1 end associate end subroutine foo subroutine comment1 type(tlap) :: grib integer :: i grib%z = [3,2,1] associate(k=>grib%z) i = k(1) if (any(k==1)) i = 1 end associate if (i .eq. 3) stop 3 end subroutine comment1 subroutine comment3(k_2d) implicit none integer :: k_2d(:) integer :: i associate(k=>k_2d) i = k(1) if (any(k==1)) i = 1 end associate if (i .eq. 3) stop 4 end subroutine comment3 subroutine comment11(k_2d) implicit none integer :: k_2d(:) integer :: m(1) = 42 real :: r(1,1) = 3.0 if ((m == r) .neqv. .true.) stop 5 associate (k=>k_2d) if ((k == r) .neqv. .true.) stop 6 ! failed to find user defined operator end associate associate (k=>k_2d(:)) if ((k == r) .neqv. .true.) stop 7 end associate end subroutine comment11 subroutine comment10 implicit none type(ulap) :: z(2) integer :: i real :: r(1,1) = 3.0 z(1)%u = [tlap([1,2,3]),tlap([4,5,6])] z(2)%u = [tlap([7,8,9]),tlap([10,11,12])] associate (k=>z(2)%u(1)%z) i = k(1) if (any(k==8)) i = 1 end associate if (i .ne. 1) stop 8 associate (k=>z(1)%u(2)%z) if ((k == r) .neqv. .true.) stop 9 if (any (k .ne. [4,5,6])) stop 10 end associate end subroutine comment10 end program pr109948
next prev parent reply other threads:[~2023-05-31 17:11 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-24 0:20 [Bug fortran/109948] New: " rimvydas.jas at gmail dot com 2023-05-24 17:05 ` [Bug fortran/109948] " rimvydas.jas at gmail dot com 2023-05-24 17:14 ` [Bug fortran/109948] [13/14 Regression] " anlauf at gcc dot gnu.org 2023-05-24 17:19 ` anlauf at gcc dot gnu.org 2023-05-24 18:35 ` anlauf at gcc dot gnu.org 2023-05-25 3:07 ` rimvydas.jas at gmail dot com 2023-05-25 7:36 ` rguenth at gcc dot gnu.org 2023-05-25 18:34 ` anlauf at gcc dot gnu.org 2023-05-25 19:20 ` anlauf at gcc dot gnu.org 2023-05-26 9:47 ` pault at gcc dot gnu.org 2023-05-26 10:15 ` pault at gcc dot gnu.org 2023-05-26 10:34 ` mikael at gcc dot gnu.org 2023-05-26 21:00 ` anlauf at gcc dot gnu.org 2023-05-26 21:25 ` anlauf at gcc dot gnu.org 2023-05-26 21:35 ` anlauf at gcc dot gnu.org 2023-05-30 8:59 ` pault at gcc dot gnu.org 2023-05-31 17:11 ` pault at gcc dot gnu.org [this message] 2023-05-31 18:39 ` anlauf at gcc dot gnu.org 2023-05-31 19:39 ` mikael at gcc dot gnu.org 2023-06-02 7:42 ` cvs-commit at gcc dot gnu.org 2023-06-02 9:13 ` pault at gcc dot gnu.org 2023-06-02 9:16 ` pault at gcc dot gnu.org 2023-08-27 8:51 ` cvs-commit at gcc dot gnu.org 2023-09-07 16:04 ` anlauf at gcc dot gnu.org 2023-09-07 16:06 ` anlauf at gcc dot gnu.org 2023-09-28 8:57 ` anlauf 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-109948-4-LotxKhOINH@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).