public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53900] New: Too optimistic on a alignment assert
@ 2012-07-09 14:57 gael.guennebaud at gmail dot com
  2012-07-09 15:23 ` [Bug c++/53900] [regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gael.guennebaud at gmail dot com @ 2012-07-09 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53900
           Summary: Too optimistic on a alignment assert
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gael.guennebaud@gmail.com


Created attachment 27766
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27766
an example triggering the issue.

Since gcc 4.7 the assertion of the attached piece of code is resolved at
compile-time while there is no guaranty, for instance when using a non-aligned
memory allocator, or on some systems where function arguments cannot be
aligned.

Here is the output with gcc-4.7:

$ g++-4.7 -m32 alignedassert.cpp && ./a.out
0x8321008
0x832100c

no assertion!

And with gcc 4.6:

$ g++-4.6 -m32 alignedassert.cpp && ./a.out
0x9322008
a.out: alignedassert.cpp:12: Foo::Foo(): Assertion `(std::ptrdiff_t(array) &
std::ptrdiff_t(0xf))==0' failed.
Aborted


Or without the -m32 flag:

$ g++-4.7 alignedassert.cpp && ./a.out
0xde3010
0xde3014

$ g++-4.6 alignedassert.cpp && ./a.out
0x1f03010
0x1f03014
a.out: alignedassert.cpp:12: Foo::Foo(): Assertion `(std::ptrdiff_t(array) &
std::ptrdiff_t(0xf))==0' failed.
Aborted


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-02-19 15:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 14:57 [Bug c++/53900] New: Too optimistic on a alignment assert gael.guennebaud at gmail dot com
2012-07-09 15:23 ` [Bug c++/53900] [regression] " rguenth at gcc dot gnu.org
2012-07-09 16:12 ` gael.guennebaud at gmail dot com
2012-07-09 16:19 ` rguenth at gcc dot gnu.org
2012-07-10 11:09 ` gael.guennebaud at gmail dot com
2012-12-28 17:47 ` xarthisius.kk at gmail dot com
2013-01-07  4:27 ` pinskia at gcc dot gnu.org
2013-01-07 10:19 ` chtz at informatik dot uni-bremen.de
2013-01-07 10:22 ` pinskia at gcc dot gnu.org
2015-02-19 15:27 ` jacob.benoit.1 at gmail dot com

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).