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/102689] Segfault with RESHAPE of CLASS as actual argument Date: Wed, 29 Nov 2023 10:35:09 +0000 [thread overview] Message-ID: <bug-102689-4-cpaG8lDpMQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102689-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102689 Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-11-29 CC| |pault at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- Confirmed! implicit none (type, external) type t integer :: i end type t integer :: j integer :: src(100) = [(j, j=1,100)] class(t), allocatable :: B(:,:,:), D(:) allocate(t :: B(10,10,1)) B(:,:,:)%i = RESHAPE(src, shape(B)) D = reshape(B, [100]) call class_bar(D) contains subroutine class_bar(x) class(t), intent(in) :: x(:) integer :: k if (any (x(:)%i /= [(k, k=1,100)])) error stop 1 end end Works as intended. Inspection of the original code reveals: atmp.19.dtype = {.elem_len=4, .rank=1, .type=5}; atmp.19.dim[0].stride = 1; atmp.19.dim[0].lbound = 0; atmp.19.dim[0].ubound = 99; atmp.19.span = 4; atmp.19.data = (void * restrict) &A.20; atmp.19.offset = 0; _gfortran_reshape (&atmp.19, D.4442, D.4451, 0B, 0B); class_bar (atmp.19); ie. The class formal argument is being fed an array descriptor. This is a problem with gfc_conv_procedure_call. The discussion about inlining or not is for another day :-) Thanks for the report, Tobias. Paul
next prev parent reply other threads:[~2023-11-29 10:35 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-11 20:00 [Bug fortran/102689] New: " burnus at gcc dot gnu.org 2023-11-29 10:35 ` pault at gcc dot gnu.org [this message] 2023-11-30 14:15 ` [Bug fortran/102689] " 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-102689-4-cpaG8lDpMQ@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).