public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/58145] New: [Regression]: volatileness of write is discarded, perhaps in "lim1" related to loop optimizations
@ 2013-08-13  2:38 hp at gcc dot gnu.org
  2013-08-13 22:56 ` [Bug middle-end/58145] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hp at gcc dot gnu.org @ 2013-08-13  2:38 UTC (permalink / raw)
  To: gcc-bugs

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.


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

end of thread, other threads:[~2013-08-16  1:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13  2:38 [Bug middle-end/58145] New: [Regression]: volatileness of write is discarded, perhaps in "lim1" related to loop optimizations hp at gcc dot gnu.org
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

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