public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/93762] Truncation of deferred-length string when passing as optional Date: Fri, 10 Apr 2020 16:49:32 +0000 [thread overview] Message-ID: <bug-93762-4-13PaZRn7Sg@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-93762-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93762 Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-04-10 CC| |tkoenig at gcc dot gnu.org --- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Unfortunately, the test case fails with different ways on current trunk: $ gfortran -g a.f90 $ ./a.out at bot of deepest_call, str is "12345" Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x7f0a66c3059f in ??? at /usr/src/debug/glibc-2.26-lp151.19.11.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 #1 0x400c65 in __interface_call_m_MOD_interface_call at /tmp/a.f90:20 #2 0x400d99 in MAIN__ at /tmp/a.f90:32 #3 0x400f0b in main at /tmp/a.f90:25 Speicherzugriffsfehler (Speicherabzug geschrieben) (gdb) r a.f90 Starting program: /tmp/a.out a.f90 at bot of deepest_call, str is "12345" Program received signal SIGSEGV, Segmentation fault. _gfortran_string_len_trim (s=0x6068d0 "12345", len=<optimized out>) at ../../../gcc/libgfortran/intrinsics/string_intrinsics_inc.c:231 231 if (*((unsigned long*) (s + i + 1)) != blank_longword) (gdb) p s $1 = 0x6068d0 "12345" (gdb) p i $2 = 564082115390472183 Seems like uninitialzed memory for i. Valgrind confirms this: $ valgrind ./a.out ==5621== Memcheck, a memory error detector ==5621== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==5621== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info ==5621== Command: ./a.out ==5621== at bot of deepest_call, str is "12345" ==5621== Conditional jump or move depends on uninitialised value(s) ==5621== at 0x50A29A5: _gfortran_string_len_trim (string_intrinsics_inc.c:188) ==5621== by 0x50A2A87: _gfortran_string_trim (string_intrinsics_inc.c:168) ==5621== by 0x400C65: __interface_call_m_MOD_interface_call (a.f90:20) ==5621== by 0x400D99: MAIN__ (a.f90:32) ==5621== by 0x400F0B: main (a.f90:25) Not sure if this ever worked in a released version.
next parent reply other threads:[~2020-04-10 16:49 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-93762-4@http.gcc.gnu.org/bugzilla/> 2020-04-10 16:49 ` tkoenig at gcc dot gnu.org [this message] 2020-04-10 22:36 ` kargl at gcc dot gnu.org 2020-04-10 23:10 ` sgk at troutmask dot apl.washington.edu 2021-03-12 22:57 ` neil.n.carlson at gmail dot com 2023-12-02 14:15 ` cvs-commit at gcc dot gnu.org 2023-12-10 20:14 ` cvs-commit at gcc dot gnu.org 2023-12-10 20:16 ` 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-93762-4-13PaZRn7Sg@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).