public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62006] New: Bad code generation with -O3 (possibly due to -ftree-partial-pre)
@ 2014-08-04 10:40 tkoeppe at google dot com
  2014-08-04 10:55 ` [Bug tree-optimization/62006] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tkoeppe at google dot com @ 2014-08-04 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62006
           Summary: Bad code generation with -O3 (possibly due to
                    -ftree-partial-pre)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoeppe at google dot com

Created attachment 33231
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33231&action=edit
Demonstrates bad code generation with -O3

I was writing some code to demonstrate custom allocators with fancy pointers.
While testing it with GCC, I noticed memory corruption when compiling with -O3.
Jonathan Wakely had a quick look and narrowed it down to "-O2
-ftree-partial-pre"; with just "-O2" the code works.

I don't have any insights in the problem, so I'm just attaching the full code.
You can tell that it's broken by passing the program through valgrind, or
simply by noting that it prints all container elements as zero, rather than
their actual values.

(Incidentally, I believe there's a similar problem in Clang:
http://llvm.org/bugs/show_bug.cgi?id=20524)


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

end of thread, other threads:[~2014-08-05 13:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 10:40 [Bug c++/62006] New: Bad code generation with -O3 (possibly due to -ftree-partial-pre) tkoeppe at google dot com
2014-08-04 10:55 ` [Bug tree-optimization/62006] " redi at gcc dot gnu.org
2014-08-04 11:24 ` rguenth at gcc dot gnu.org
2014-08-04 12:00 ` rguenth at gcc dot gnu.org
2014-08-04 12:05 ` tkoeppe at google dot com
2014-08-04 12:13 ` rguenth at gcc dot gnu.org
2014-08-04 13:20 ` rguenth at gcc dot gnu.org
2014-08-04 13:23 ` rguenth at gcc dot gnu.org
2014-08-04 13:31 ` tkoeppe at google dot com
2014-08-04 13:44 ` rguenther at suse dot de
2014-08-05 13:06 ` rguenth at gcc dot gnu.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).