This test case fails with latest gcc 4.3.0. The test assumes 32 bit integers,
but even after changing the constants to long, it produces incorrect results.

With -O2 we get this:

int f(unsigned number_of_digits_to_use)
{
 if (number_of_digits_to_use > 1294)
206:        65 e0               ldi        r22, 0x05        ; 5
208:        8f 30               cpi        r24, 0x0F        ; 15
20a:        96 07               cpc        r25, r22
20c:        c0 f4               brcc        .+48             ; 0x23e <f+0x38>
   return 0;
 return ((number_of_digits_to_use * 3321928L) / 1000000L + 1) /16;
20e:        bc 01               movw        r22, r24
210:        80 e0               ldi        r24, 0x00        ; 0
212:        90 e0               ldi        r25, 0x00        ; 0
214:        0e 94 6c 06         call        0xcd8        ; 0xcd8 <__mulsi3>
[...]

It "forgets" to load r18:r19:r20:r21 with 3321928 before calling __mulsi3.


-- 
           Summary: gcc.c-torture/execute/pr27364.c fails with -O1, -O2 and
                    -Os
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pmarques at grupopie dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: avr-*-*


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

Reply via email to