public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43987]  New: [4.5 regression] type-punning causes broken binaries unless -O0 is used
@ 2010-05-04 22:46 thomas at archlinux dot org
  2010-05-04 22:48 ` [Bug middle-end/43987] " pinskia at gcc dot gnu dot org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: thomas at archlinux dot org @ 2010-05-04 22:46 UTC (permalink / raw)
  To: gcc-bugs

I noticed this when building busybox 1.16.1, but I also saw this in other code:

When building with -O2 I get warnings like:
'warning: dereferencing type-punned pointer will break strict-aliasing rules'

The produced binary is broken, in the case of busybox, the 'sed' applet
segfaults.

When adding -fno-strict-aliasing, the warnings disappear, but the resulting
binary is still broken (with no warning or error indicating that something is
broken). The same also happens with -O1 or -Os, only a -O0 binary will work.

This used to work fine in gcc 4.4. I don't know how a test case would look
like, as I don't know the code that breaks that closely.

In my opinion, one of the following should happen:
a) gcc 4.5 should produce code that works
b) gcc 4.5 should throw a warning or error indicating that the code is
incorrect


-- 
           Summary: [4.5 regression] type-punning causes broken binaries
                    unless -O0 is used
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thomas at archlinux dot org
 GCC build triplet: x86_64-unknown-linux-gnu / i686-pc-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu / i686-pc-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu / i686-pc-linux-gnu


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


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

end of thread, other threads:[~2010-05-21  8:16 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-04 22:46 [Bug c/43987] New: [4.5 regression] type-punning causes broken binaries unless -O0 is used thomas at archlinux dot org
2010-05-04 22:48 ` [Bug middle-end/43987] " pinskia at gcc dot gnu dot org
2010-05-04 22:49 ` pinskia at gcc dot gnu dot org
2010-05-04 23:06 ` thomas at archlinux dot org
2010-05-04 23:08 ` pinskia at gcc dot gnu dot org
2010-05-04 23:50 ` thomas at archlinux dot org
2010-05-04 23:53 ` pinskia at gcc dot gnu dot org
2010-05-05  7:23 ` thomas at archlinux dot org
2010-05-05 10:16 ` rguenth at gcc dot gnu dot org
2010-05-05 10:53 ` thomas at archlinux dot org
2010-05-05 10:58 ` thomas at archlinux dot org
2010-05-05 11:57 ` thomas at archlinux dot org
2010-05-05 13:14 ` rguenth at gcc dot gnu dot org
2010-05-05 13:17 ` [Bug middle-end/43987] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
2010-05-05 13:28 ` rguenth at gcc dot gnu dot org
2010-05-05 13:56 ` rguenth at gcc dot gnu dot org
2010-05-05 14:02 ` rguenth at gcc dot gnu dot org
2010-05-05 14:11 ` thomas at archlinux dot org
2010-05-05 14:13 ` rguenther at suse dot de
2010-05-06  8:53 ` rguenth at gcc dot gnu dot org
2010-05-06  8:54 ` [Bug middle-end/43987] [4.5 " rguenth at gcc dot gnu dot org
2010-05-10 16:49 ` bernhardloos at googlemail dot com
2010-05-19 12:54 ` rguenth at gcc dot gnu dot org
2010-05-19 14:49 ` rguenth at gcc dot gnu dot org
2010-05-19 15:08 ` rguenth at gcc dot gnu dot org
2010-05-21  8:16 ` thomas at archlinux dot org

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