public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56341] GCC produces unaligned data access
Date: Wed, 20 Feb 2013 01:38:00 -0000	[thread overview]
Message-ID: <bug-56341-4-Em7bcLV8CT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56341-4@http.gcc.gnu.org/bugzilla/>


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

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29465|0                           |1
        is obsolete|                            |

--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> 2013-02-20 01:38:04 UTC ---
Created attachment 29506
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29506
proposed patch

this patch uses packedp only for the warn_misaligned_bitfield()
but does always use multiple load or stores. So even if the
packedp may be unreliable it will only have influence on the warning text.

reason:
if packedp == false the code will always use a single but mis-aligned
instruction which is known to abort at runtime. So that is always wrong.

note: there are two almost identical formula used for packedp.

packedp as it is used in extract_bit_field (old code):
        if (TYPE_PACKED (TREE_TYPE (TREE_OPERAND (exp, 0)))
            || (TREE_CODE (TREE_OPERAND (exp, 1)) == FIELD_DECL
                && DECL_PACKED (TREE_OPERAND (exp, 1))))
          packedp = true;

packedp as it is used in store_field (new code):
        if (TREE_CODE(to) == COMPONENT_REF
            && (TYPE_PACKED (TREE_TYPE (TREE_OPERAND (to, 0)))
                || (TREE_CODE (TREE_OPERAND (to, 1)) == FIELD_DECL
                    && DECL_PACKED (TREE_OPERAND (to, 1)))))
          packedp = true;

However if we can not trust the second one why should we trust the first one?

Therefore the packedp should not have influence on the code generation at all.
That would only take unnecessary risks.

Well, I think that should resolve your objections... Right?


  parent reply	other threads:[~2013-02-20  1:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 13:09 [Bug c/56341] New: " bernd.edlinger at hotmail dot de
2013-02-15 13:13 ` [Bug c/56341] " bernd.edlinger at hotmail dot de
2013-02-15 14:19 ` mikpe at it dot uu.se
2013-02-15 14:47 ` bernd.edlinger at hotmail dot de
2013-02-15 15:26 ` [Bug middle-end/56341] " pinskia at gcc dot gnu.org
2013-02-18 11:21 ` rguenth at gcc dot gnu.org
2013-02-18 15:31 ` sandra at codesourcery dot com
2013-02-18 18:42 ` bernd.edlinger at hotmail dot de
2013-02-20  1:38 ` bernd.edlinger at hotmail dot de [this message]
2013-02-26 18:25 ` bernd.edlinger at hotmail dot de
2013-03-27 10:37 ` bernd.edlinger at hotmail dot de
2013-06-03  4:11 ` sandra at codesourcery dot com
2013-06-03 13:01 ` bernd.edlinger at hotmail dot de
2013-06-14  3:01 ` sandra at codesourcery dot com
2013-10-07 15:41 ` sandra at codesourcery dot com
2013-10-30 17:08 ` ramana at gcc dot gnu.org
2013-12-11 16:50 ` edlinger at gcc dot gnu.org
2013-12-11 16:59 ` edlinger at gcc dot gnu.org
2014-01-07 13:43 ` bernd.edlinger at hotmail dot de
2014-02-27  7:28 ` jye2 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-56341-4-Em7bcLV8CT@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).