https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97884

            Bug ID: 97884
           Summary: INT_MIN falsely expanded to 64 bit
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.baur...@tu-berlin.de
  Target Milestone: ---

Created attachment 49583
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49583&action=edit
example file

arm-none-eabi-gcc: when compiling

printf("%i\n", -2147483648);
printf("%i\n", (int)-2147483648);

INT_MIN in the first call gets recognized as a 64 bit argument and split across
r2 and r3. r1 remains untouched. In the second call, INT_MIN is correctly put
into r1:

   8:   e3a02102        mov     r2, #-2147483648        ; 0x80000000
   c:   e3e03000        mvn     r3, #0
  10:   e59f0010        ldr     r0, [pc, #16]           ; 28
<start_kernel+0x28>
  14:   ebfffffe        bl      0 <printf>
  18:   e3a01102        mov     r1, #-2147483648        ; 0x80000000
  1c:   e59f0004        ldr     r0, [pc, #4]            ; 28
<start_kernel+0x28>
  20:   ebfffffe        bl      0 <printf>

Source file attached was compiled with
arm-none-eabi-gcc -v -save-temps -c start.c -o start.o

gcc 10.2.0 was configured with
--target=arm-none-eabi --prefix=$(PREFIX) --enable-interwork
--enable-languages="c" --with-newlib --without-headers --disable-nls

Reply via email to