[Bug 721531] Re: [armel] gcc computes wrong address for main() at build time

Michael Hope 721531 at bugs.launchpad.net
Thu May 26 01:58:34 UTC 2011


This fault exists in all upstream versions from 4.5 onwards including
recent trunk:

michaelh at ursa2:~/linaro/bugs$ uname -a
Linux ursa2 2.6.35.3-cbuild2+ #8 SMP Mon Apr 4 12:46:46 NZST 2011 armv7l GNU/Linux

michaelh at ursa2:~/linaro/bugs$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.10
Release:	10.10
Codename:	maverick

michaelh at ursa2:~/linaro/bugs$ /tools/toolchains/gcc-4.4.5-armv7l-maverick-cbuild93-ursa2-cortexa8r1/bin/gcc -O2 align.c ; ./a.out
HIT!

michaelh at ursa2:~/linaro/bugs$ /tools/toolchains/gcc-4.5.2-armv7l-maverick-cbuild93-ursa1-cortexa8r1/bin/gcc -O2 align.c ; ./a.out
(nothing)

michaelh at ursa2:~/linaro/bugs$ /tools/toolchains/gcc-4.6.0-armv7l-maverick-cbuild93-ursa1-cortexa8r1/bin/gcc -O2 align.c ; ./a.out
(nothing)

michaelh at ursa2:~/linaro/bugs$ ~/linaro/toolchains/gcc-4.7~svn174044-armv7l-maverick-cbuild120-ursa4-cortexa9r1/bin/gcc -O2 align.c ; ./a.out
(nothing)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.5 in Ubuntu.
https://bugs.launchpad.net/bugs/721531

Title:
  [armel] gcc computes wrong address for main() at build time

Status in Linaro GCC:
  Triaged
Status in “gcc-4.5” package in Ubuntu:
  Triaged
Status in “gcc-4.5” source package in Natty:
  Won't Fix
Status in “gcc-4.5” source package in Oneiric:
  Triaged

Bug description:
  Binary package hint: gcc-4.5

  During the debugging of mono, we found a confirmed tool chain
  regression and isolated it down to a testcase:

  Test code:

  void main() {
          void *p = main;
          if ((int)p & 1) printf ("HIT!\n"); 
  }

  Output:

  mcasadevall at risingsun:~/tmp$ gcc  -g test.c 
  test.c: In function 'main':
  test.c:3:18: warning: incompatible implicit declaration of built-in function 'printf'
  mcasadevall at risingsun:~/tmp$ ./a.out 
  HIT!

  mcasadevall at risingsun:~/tmp$ gcc  -g -O2 test.c 
  test.c: In function 'main':
  test.c:3:18: warning: incompatible implicit declaration of built-in function 'printf'
  mcasadevall at risingsun:~/tmp$ ./a.out 
  mcasadevall at risingsun:~/tmp$ 

  Doesn't occur with gcc-4.4.

  Additional comments from #monodev:
  16:26:58 < vargaz> NCommander: it seems to think function addresses on arm 
                     have their lowest bit set to 0, which is not true for 
                     thumb.




More information about the foundations-bugs mailing list