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

--- Comment #5 from Richard Henderson <rth at gcc dot gnu.org> 2012-01-05 
00:31:35 UTC ---
(In reply to comment #3)
> These tests just shuffle bytes around, so I was under impression that the
> functionality is isolated from OS. And Hello world executes correctly when
> compiled with -mbig-endian.

Hello world only manipulates pointers and spends 99% of its time in libc.

Shuffling bytes around largely depends on how and what you do with it.

Try the more obvious

  int main() { 
    union { int i; char c[4]; } u;
    u.i = 0x01020304;
    printf("%d\n", u.c[0]);
    return 0;
  }

to convince yourself we aren't actually running in big-endian mode.

(In reply to comment #4)
> Hm, should we then reject this switch on linux?

We could probably remove it entirely and let it be controlled by the
OS config headers and get better code within gcc itself.

Reply via email to