public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/112828] Abort with malloc(): corrupted top size Date: Sun, 03 Dec 2023 20:45:48 +0000 [thread overview] Message-ID: <bug-112828-4-6vmeVhmoqN@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-112828-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112828 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-12-03 Status|UNCONFIRMED |NEW Keywords| |wrong-code CC| |anlauf at gcc dot gnu.org --- Comment #6 from anlauf at gcc dot gnu.org --- I get this crash with all gfortran versions (>= 7) on x86_64-pc-linux-gnu. Sometimes optimization needs to be enabled to see this. Replacing in reallocate the line character(LEN(array)), allocatable :: array_new(:) with the actual (constant) length fixes the issue, e.g. character(LEN=64), allocatable :: array_new(:) This may be a hint. In my tests the stat variable only needs to be accessed by the line if (PRESENT(stat)) it needs not be set explicitly. Compiling with -fsanitize=address gives at runtime: - when compiled with -O0: ==30489==ERROR: AddressSanitizer: requested allocation size 0x515f9880000 (0x515f9881000 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0) #0 0x1457e8eb4527 in malloc ../../../../gcc-trunk/libsanitizer/asan/asan_malloc_linux.cpp:69 ... - with -Og and higher: ==30533==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000000071 at pc 0x152c5cbc8a79 bp 0x7fff0a124100 sp 0x7fff0a1238c0 WRITE of size 64 at 0x502000000071 thread T0 ... (details depend on optimization level).
prev parent reply other threads:[~2023-12-03 20:45 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-02 23:12 [Bug fortran/112828] New: " townsend at astro dot wisc.edu 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 [this message]
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-6vmeVhmoqN@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).