Comment 5 for bug 771832

Revision history for this message
In , Andrew Stubbs (ams-codesourcery) wrote :

Somewhat reduced testcase:

static void
f (unsigned int a)
{
  unsigned long long __res;
  if (~0ULL % (a / (a & -a)) == 0)
    {
      asm ("": "+&r" (__res));
    }
}

int
g (unsigned int a)
{
  f (a);
}

This gives:

        .global __aeabi_uidiv
        .global __aeabi_uldivmod
        .text
        .align 2
        .global g
        .thumb
        .thumb_func
        .type g, %function
g:
        .fnstart
.LFB1:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        push {lr}
        .save {lr}
        ldr pc, [sp], #4
        .fnend

So, both __aeabi_uidiv and __aeabi_uldivmod are declared global, but neither is actually used as the code is optimized away.