public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26116]  New: Optimizer regression from v3 to v4
@ 2006-02-06  8:01 gianni at mariani dot ws
  2006-02-06 10:34 ` [Bug c++/26116] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gianni at mariani dot ws @ 2006-02-06  8:01 UTC (permalink / raw)
  To: gcc-bugs

Prior to the 4.* series compilers, the following code :

char tell_endian()
{
    unsigned x = 1;
    return *(char*)&x;
}

... used to produce a simple contant load to a register and return.  The 4.x
compilers seem like they can no longer make this optimization.  It used to be
very convenient because code written using this construct would automatically
eliminate code since it was correctly able to identify that the return value
from "tell_endian" is a constant, i.e.

if ( tell_endian() ) little_stuff() else big_stuff()

would generate code consistant with simply writing "little_stuff()" on little
endian systems (and visa versa).


-- 
           Summary: Optimizer regression from v3 to v4
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gianni at mariani dot ws


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


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

end of thread, other threads:[~2006-02-06 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06  8:01 [Bug c++/26116] New: Optimizer regression from v3 to v4 gianni at mariani dot ws
2006-02-06 10:34 ` [Bug c++/26116] " rguenth 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).