public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "townsend at astro dot wisc.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/99169] New: Segfault when passing allocatable scalar into intent(out) dummy argument
Date: Fri, 19 Feb 2021 17:31:45 +0000	[thread overview]
Message-ID: <bug-99169-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99169

            Bug ID: 99169
           Summary: Segfault when passing allocatable scalar into
                    intent(out) dummy argument
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: townsend at astro dot wisc.edu
  Target Milestone: ---

Created attachment 50222
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50222&action=edit
Minimal working example

I've encountered a problem when passing an allocatable (and alread allocated)
scalar as an actual argument to a procedure with an intent(out) (but not
allocatable) dummy argument. The attached code illustrates the problem. 

Compiling with gfortran 10.2.0 at optimization level -O1 or -O2 leads to a
segmentation fault at runtime. The segfault arises when the dummy is assigned
within set_i(). This problem does not arise at optimization level -O0, and the
program performs as expected (outputting '5' to the terminal).

The problem also seems to disappear when set_i() is a CONTAINed procedure in
the main program, rather than a module procedure.

cheers,

Rich

             reply	other threads:[~2021-02-19 17:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 17:31 townsend at astro dot wisc.edu [this message]
2021-02-19 19:49 ` [Bug fortran/99169] [9/10/11 Regression] " anlauf at gcc dot gnu.org
2021-02-19 19:58 ` anlauf at gcc dot gnu.org
2021-02-19 20:13 ` anlauf at gcc dot gnu.org
2021-02-19 20:20 ` anlauf at gcc dot gnu.org
2021-02-19 21:17 ` anlauf at gcc dot gnu.org
2021-02-21 20:44 ` cvs-commit at gcc dot gnu.org
2021-02-23 18:14 ` cvs-commit at gcc dot gnu.org
2021-02-23 18:27 ` cvs-commit at gcc dot gnu.org
2021-02-23 18:29 ` anlauf at gcc dot gnu.org
2022-09-25 12:48 ` cvs-commit 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-99169-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: link
Be 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).