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/112828] New: Abort with malloc(): corrupted top size
Date: Sat, 02 Dec 2023 23:12:33 +0000	[thread overview]
Message-ID: <bug-112828-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 112828
           Summary: Abort with malloc(): corrupted top size
           Product: gcc
           Version: 13.1.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 56768
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56768&action=edit
MWE demonstrating problem

When I compile the attached MWE with

gfortran -o test test.f90

...I get the following runtime error:

malloc(): corrupted top size

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7f13a2e7760f in ???
#1  0x7f13a2ec500c in ???
#2  0x7f13a2e77571 in raise
#3  0x7f13a2e614b1 in abort
#4  0x7f13a2e623b4 in ???
#5  0x7f13a2ece874 in ???
#6  0x7f13a2ed1fdf in ???
#7  0x7f13a2ed2b59 in __libc_malloc
#8  0x40191a in MAIN__
#9  0x401c8c in main
Aborted

If I comment out the first allocate statement (the one with the STAT argument),
then the program runs without problem (even though this statement isn't
actually executed). There are a number of other things that make the bug go
away; e.g., shrinking the length of the character variables in the main program
to 20 or smaller. Setting the length to 21 still runs without error, but the
second element of c_r ends up with some junk in it, viz:

 foo                  foo                A

cheers,

Rich

             reply	other threads:[~2023-12-02 23:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02 23:12 townsend at astro dot wisc.edu [this message]
2023-12-03 13:38 ` [Bug fortran/112828] " fxcoudert at gcc dot gnu.org
2023-12-03 15:01 ` townsend at astro dot wisc.edu
2023-12-03 16:28 ` townsend at astro dot wisc.edu
2023-12-03 16:54 ` townsend at astro dot wisc.edu
2023-12-03 18:33 ` townsend at astro dot wisc.edu
2023-12-03 20:45 ` 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-112828-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).