public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hp at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58145] New: [Regression]: volatileness of write is discarded, perhaps in "lim1" related to loop optimizations
Date: Tue, 13 Aug 2013 02:38:00 -0000	[thread overview]
Message-ID: <bug-58145-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 58145
           Summary: [Regression]: volatileness of write is discarded,
                    perhaps in "lim1" related to loop optimizations
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hp at gcc dot gnu.org
            Target: cris-*-*, crisv32-*-*

Created attachment 30640
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30640&action=edit
Preprocessed code; compile at -O2, e.g. "cc1 -O2 y.i -o y.s"

The exact version in which the bug appeared is not yet triaged: it's present on
r201675 of trunk, r201652 of the 4.8 branch, r190527 of the 4.7 branch (!) but
appears to not be present in r135713 of the 4.3 branch (!).

The bug is that the volatileness of the dereference of the write (the
assignment through a pointer to a volatile structure) in function pb_out is
discarded, leaving a single write after the loop.  Note also that together with
the discarded-volatileness-bug there seems to be a missed-optimization-bug in
that the loop is redundant; the loop awkwardly computes iterates over 0..31 and
computes 1<<i but the intermediate computations aren't used; then the last
value is written after the loop. Editing the code to manually inline pb_out
makes no difference to the bug.

The wrong code is evident already in the .expand dump on trunk (according to
-da).  It is not present (according to -fdump-tree-all-all) in
y.i.096t.loopinit but appears present in y.i.097t.lim1.

Until someone (including myself) has repeated the observation for another
target, I'll set the target-specifier to cris*-* but it seems obviously
generic, affecting all targets.


             reply	other threads:[~2013-08-13  2:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13  2:38 hp at gcc dot gnu.org [this message]
2013-08-13 22:56 ` [Bug middle-end/58145] " jakub at gcc dot gnu.org
2013-08-14 10:09 ` jakub at gcc dot gnu.org
2013-08-14 20:37 ` jakub at gcc dot gnu.org
2013-08-16  1:32 ` hp 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-58145-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).