public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28727]  New: Wrong code generated (assignment incorrectly optimized out)
@ 2006-08-14 18:58 qrczak at knm dot org dot pl
  2006-08-14 19:00 ` [Bug c/28727] " qrczak at knm dot org dot pl
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: qrczak at knm dot org dot pl @ 2006-08-14 18:58 UTC (permalink / raw)
  To: gcc-bugs

The attached module, when compiled with -O2, has wrong code generated for the
last set_global_field call. The assembly shows:

        leal    4(%edx), %eax
        cmpl    marked_limit, %eax
        movl    BadArguments, %ecx
        movl    $record_12420+4, (%edx)
        movl    %eax, marked_top
        jbe     .L28
        movl    %ecx, record_12420+4
        call    gc
.L28:
        leave
        xorl    %eax, %eax
        ret

while the assignment of BadArguments (from %ecx) to record_12420+4 should be
performed unconditionally, as can be easily deduced from the source.

This is gcc-4.2.0-0.20060806r115974. The bug doesn't manifest without -O2 or
when the number of set_global_field calls is reduced.


-- 
           Summary: Wrong code generated (assignment incorrectly optimized
                    out)
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: qrczak at knm dot org dot pl
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c/28727] Wrong code generated (assignment incorrectly optimized out)
  2006-08-14 18:58 [Bug c/28727] New: Wrong code generated (assignment incorrectly optimized out) qrczak at knm dot org dot pl
@ 2006-08-14 19:00 ` qrczak at knm dot org dot pl
  2006-08-14 19:11 ` [Bug middle-end/28727] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: qrczak at knm dot org dot pl @ 2006-08-14 19:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from qrczak at knm dot org dot pl  2006-08-14 19:00 -------
Created an attachment (id=12075)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12075&action=view)
Test case


-- 


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


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

* [Bug middle-end/28727] Wrong code generated (assignment incorrectly optimized out)
  2006-08-14 18:58 [Bug c/28727] New: Wrong code generated (assignment incorrectly optimized out) qrczak at knm dot org dot pl
  2006-08-14 19:00 ` [Bug c/28727] " qrczak at knm dot org dot pl
@ 2006-08-14 19:11 ` pinskia at gcc dot gnu dot org
  2006-08-26 19:15 ` qrczak at knm dot org dot pl
  2006-08-26 20:46 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-14 19:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-14 19:10 -------
Most likely related to PR 28003.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |28003
           Keywords|                            |alias


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


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

* [Bug middle-end/28727] Wrong code generated (assignment incorrectly optimized out)
  2006-08-14 18:58 [Bug c/28727] New: Wrong code generated (assignment incorrectly optimized out) qrczak at knm dot org dot pl
  2006-08-14 19:00 ` [Bug c/28727] " qrczak at knm dot org dot pl
  2006-08-14 19:11 ` [Bug middle-end/28727] " pinskia at gcc dot gnu dot org
@ 2006-08-26 19:15 ` qrczak at knm dot org dot pl
  2006-08-26 20:46 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: qrczak at knm dot org dot pl @ 2006-08-26 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from qrczak at knm dot org dot pl  2006-08-26 19:15 -------
The problem seems to be caused by illegal type punning. Rewriting the code to
avoid pointer casts cures the bug, and -fno-strict-aliasing cures it too, so
gcc is probably correct.

Thanks to Michael Veksler for pointing this out.


-- 


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


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

* [Bug middle-end/28727] Wrong code generated (assignment incorrectly optimized out)
  2006-08-14 18:58 [Bug c/28727] New: Wrong code generated (assignment incorrectly optimized out) qrczak at knm dot org dot pl
                   ` (2 preceding siblings ...)
  2006-08-26 19:15 ` qrczak at knm dot org dot pl
@ 2006-08-26 20:46 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-26 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-08-26 20:46 -------


*** This bug has been marked as a duplicate of 21920 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2006-08-26 20:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-14 18:58 [Bug c/28727] New: Wrong code generated (assignment incorrectly optimized out) qrczak at knm dot org dot pl
2006-08-14 19:00 ` [Bug c/28727] " qrczak at knm dot org dot pl
2006-08-14 19:11 ` [Bug middle-end/28727] " pinskia at gcc dot gnu dot org
2006-08-26 19:15 ` qrczak at knm dot org dot pl
2006-08-26 20:46 ` pinskia at gcc dot gnu 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).