public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/31922] Accessing uninitialized variable for print *, trim(blank_string) Date: Mon, 14 May 2007 19:24:00 -0000 [thread overview] Message-ID: <20070514192437.28607.qmail@sourceware.org> (raw) In-Reply-To: <bug-31922-13404@http.gcc.gnu.org/bugzilla/> ------- Comment #1 from burnus at gcc dot gnu dot org 2007-05-14 20:24 ------- Jerry, you are one of the libgfortran/IO experts, could you have a look? _gfortran_transfer_character (&dt_parm.0, pstr.1, len.2); uses uninitialized memory if len = 0 and p = NULL. This happens because empty_string is not initialized to anything and points to a random position. However, it is later tested for "p == NULL". transfer_character (st_parameter_dt *dtp, void *p, int len) { static char *empty_string[0]; [..] if (len == 0 && p == NULL) p = empty_string; dtp->u.p.transfer (dtp, BT_CHARACTER, p, len, len, 1); And in: formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, n = (p == NULL) ? 0 : ((type != BT_COMPLEX) ? 1 : 2); Would be the following a correctly working alternative? static char empty_string[0]; if (len == 0 && p == NULL) p = &empty_string; -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31922
next prev parent reply other threads:[~2007-05-14 19:24 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-05-14 18:25 [Bug fortran/31922] New: " burnus at gcc dot gnu dot org 2007-05-14 19:24 ` burnus at gcc dot gnu dot org [this message] 2007-05-15 2:38 ` [Bug fortran/31922] " jvdelisle at gcc dot gnu dot org 2007-05-15 7:52 ` burnus at gcc dot gnu dot org 2007-05-16 0:38 ` jvdelisle at gcc dot gnu dot org 2007-05-16 0:40 ` [Bug fortran/31922] [4.2 only] " jvdelisle at gcc dot gnu dot org 2007-05-20 23:00 ` jvdelisle at gcc dot gnu dot 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=20070514192437.28607.qmail@sourceware.org \ --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).