https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65716
Bug ID: 65716 Summary: Integral promotion wrong with arm version Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juan-antonio.gar...@nabla-designs.com Created attachment 35277 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35277&action=edit Compiler output to gcc -v -save-temps test.c: int main() { char a =-1; int b = a; while(b>0); return 0; } This program has different behaviour in i386 and arm architectures. i386 : The program exits normally. arm : The program loops for ever because evaluates b > 0. ****************************************************************** test.i: # 1 "test.c" # 1 "<interno>" # 1 "<lĂnea-de-orden>" # 1 "test.c" int main() { char a =-1; int b = a; while(b>0); return 0; } ******************************************************************** test.s: .syntax unified .arch armv7-a .eabi_attribute 27, 3 .fpu vfpv3-d16 .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 6 .eabi_attribute 34, 1 .eabi_attribute 18, 4 .thumb .file "test.c" .text .align 2 .global main .thumb .thumb_func .type main, %function main: @ args = 0, pretend = 0, frame = 8 @ frame_needed = 1, uses_anonymous_args = 0 @ link register save eliminated. push {r7} sub sp, sp, #12 add r7, sp, #0 mov r3, #255 strb r3, [r7, #7] ldrb r3, [r7, #7] @ zero_extendqisi2 str r3, [r7, #0] .L2: ldr r3, [r7, #0] cmp r3, #0 bgt .L2 mov r3, #0 mov r0, r3 add r7, r7, #12 mov sp, r7 pop {r7} bx lr .size main, .-main .ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3" .section .note.GNU-stack,"",%progbits