public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58270] Wrong code while accessing trailing array elements in a global common structure
Date: Tue, 03 Sep 2013 09:23:00 -0000	[thread overview]
Message-ID: <bug-58270-4-dscpwri7vW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58270-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58270

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|i386-pc-linux               |
             Status|WAITING                     |NEW
                 CC|                            |rguenth at gcc dot gnu.org
          Component|fortran                     |middle-end
               Host|i386-pc-linux               |
            Summary|Wrong code while accessing  |Wrong code while accessing
                   |array elements in a global  |trailing array elements in
                   |structure                   |a global common structure
      Known to fail|                            |4.9.0

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
DECL_COMMONs could be special-cased in places that look at DECL_SIZE (I'll
declare this a QOI issue).  Or all decls that do not bind locally.  The
place that would "fix" tree-fre, tree-pre and tree-dse is in
get_ref_base_and_extent where it does

  if (DECL_P (exp))
    {
      /* If maxsize is unknown adjust it according to the size of the
         base decl.  */
      if (maxsize == -1
          && host_integerp (DECL_SIZE (exp), 1))
        maxsize = TREE_INT_CST_LOW (DECL_SIZE (exp)) - hbit_offset;
    }
  else if (CONSTANT_CLASS_P (exp))
    {
      /* If maxsize is unknown adjust it according to the size of the
         base type constant.  */
      if (maxsize == -1
          && host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1))
        maxsize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))) - hbit_offset;
    }

In its general processing the function treats all trailing arrays as possibly
of undefined size.

Note that because -fcommon is still the default for all C dialects the
impact of changing the above for example in the simple && !DECL_COMMON (exp)
way is unknown.  -fcommon is a source of interesting bugs.


  parent reply	other threads:[~2013-09-03  9:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29 10:48 [Bug c/58270] New: Wrong code accessing array elements strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 10:58 ` [Bug c/58270] Wrong code while accessing array elements in a global structure fweimer at redhat dot com
2013-08-29 11:15 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 11:29 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 12:19 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 12:21 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 12:23 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 12:39 ` mikpe at it dot uu.se
2013-08-29 13:32 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-08-29 14:48 ` jakub at gcc dot gnu.org
2013-08-29 16:23 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-02  8:20 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-02  8:24 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-02 12:21 ` [Bug fortran/58270] " dominiq at lps dot ens.fr
2013-09-02 13:14 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-02 14:39 ` dominiq at lps dot ens.fr
2013-09-02 16:32 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-02 17:53 ` dominiq at lps dot ens.fr
2013-09-03  7:56 ` strasbur at chkw386 dot ch.pwr.wroc.pl
2013-09-03  9:23 ` rguenth at gcc dot gnu.org [this message]
2013-09-03  9:41 ` [Bug middle-end/58270] Wrong code while accessing trailing array elements in a global common structure dominiq at lps dot ens.fr
2013-09-03  9:48 ` dominiq at lps dot ens.fr
2021-11-29  2:32 ` pinskia 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-58270-4-dscpwri7vW@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).