------- Comment #2 from pinskia at gcc dot gnu dot org 2006-02-02 05:19 ------- If you used GCC's extension of using an union as not violating aliasing rules, it works there but does not with using the portable ways: bool tell_endian() { unsigned x = 1; return *(char*)&x; }
bool tell_endian1() { char a; int x = 1; __builtin_memcpy(&a, &x, 1); return a; } bool tell_endian_good() { union{int i;char c;}a; a.i = 1; return a.c; } ----- Only tell_endian_good produces good result. This looks like the removal of addressof RTL caused this. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC host triplet|linux-x86-elf | GCC target triplet|linux-x86-elf | Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2006-02-02 05:19:37 date| | Summary|Runtime endian-ness check is|[4.0/4.1/4.2 Regression] |no longer optimized out. |Runtime endian-ness check is | |no longer optimized out. Target Milestone|--- |4.0.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26069