public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "npl at chello dot at" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65945] New: ARM: unaligned access when stroing nullptr
Date: Thu, 30 Apr 2015 10:08:00 -0000	[thread overview]
Message-ID: <bug-65945-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65945

            Bug ID: 65945
           Summary: ARM: unaligned access when stroing nullptr
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npl at chello dot at
  Target Milestone: ---

Created attachment 35429
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35429&action=edit
code causing the issue

Hello,

the attachedcode produces an unaligned access for arm, on the production code I
ran into this issue with versions 5.1, 4.9.2, 4.8.4. This reduced testcase
doesnt produce the issue with 5.1, but for 4.9.2 and 4.8.4.

The issue seems to be the line
constexpr inline_type bool operator ==(bitmask X, decltype(nullptr)) \
{ return X == bitmask(); }

aparrently gcc converts stores the given parameter on the frame without caring
for alignment ("str      r3, [fp, #-25]"). changing the type to unsigned seems
to fix this

Commandline to reproduce:
arm-none-eabi-g++ -std=c++11 -O0 -c unalignedgcc.cpp


             reply	other threads:[~2015-04-30 10:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 10:08 npl at chello dot at [this message]
2015-04-30 10:09 ` [Bug c++/65945] " npl at chello dot at
2015-04-30 10:13 ` npl at chello dot at
2015-04-30 11:29 ` [Bug c++/65945] C++ alignment of nullptr_t is 1 and might cause unaligned stores to the frame redi at gcc dot gnu.org
2015-04-30 13:47 ` npl at chello dot at
2015-04-30 13:57 ` npl at chello dot at
2015-04-30 14:30 ` pinskia at gcc dot gnu.org
2015-04-30 20:27 ` npl at chello dot at
2015-05-22 18:20 ` foom at fuhm dot net
2015-05-25 13:23 ` ebotcazou at gcc dot gnu.org
2015-06-04 21:32 ` foom at fuhm dot net
2015-06-19 14:08 ` foom at fuhm dot net
2015-07-01 17:07 ` jason at gcc dot gnu.org
2015-07-01 17:59 ` jason at gcc dot gnu.org
2015-07-01 18:01 ` jason at gcc dot gnu.org
2015-07-01 18:07 ` jason at gcc dot gnu.org
2015-07-10 11:08 ` npl at chello dot at

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-65945-4@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).