public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoeppe at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62006] New: Bad code generation with -O3 (possibly due to -ftree-partial-pre)
Date: Mon, 04 Aug 2014 10:40:00 -0000	[thread overview]
Message-ID: <bug-62006-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2014-08-04 10:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 10:40 tkoeppe at google dot com [this message]
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

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