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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> Created attachment 48702 [details]
> _absvsi2_s.c
> 
> To reproduce:
> ...
> $ gcc -O2 -g -fpic -mlong-double-80 -fcf-protection -mshstk
> -fbuilding-libgcc -fno-stack-protector -o _absvsi2_s.o -c _absvsi2_s.c
> -save-temps
> ...

Minimal example test.c:
...
#include <stdlib.h>

int
foo (int a)
{
  int w = a;

  if (a < 0)
    w = -(unsigned int) a;

  if (w < 0)
    abort ();

   return w;
}
...

Compiled like this:
...
$ gcc test.c -O2 -g -c -fno-reorder-blocks-and-partition
...

resulting in test.s:
...
        .file   "test.c"
        .text
.Ltext0:
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LVL0:
.LFB13:
        .file 1 "test.c"
        .loc 1 5 1 view -0
        .cfi_startproc
        .loc 1 6 3 view .LVU1
        .loc 1 8 3 view .LVU2
        .loc 1 5 1 is_stmt 0 view .LVU3
        movl    %edi, %eax
        .loc 1 8 6 view .LVU4
        testl   %edi, %edi
        js      .L7
.LVL1:
.L2:
        .loc 1 14 4 is_stmt 1 view .LVU5
        .loc 1 15 1 is_stmt 0 view .LVU6
        ret
.LVL2:
        .p2align 4,,10
        .p2align 3
.L7:
        .loc 1 9 5 is_stmt 1 view .LVU7
        .loc 1 9 9 is_stmt 0 view .LVU8
        negl    %eax
.LVL3:
        .loc 1 11 3 is_stmt 1 view .LVU9
        .loc 1 11 6 is_stmt 0 view .LVU10
        testl   %eax, %eax
        jns     .L2
        .loc 1 12 5 is_stmt 1 view .LVU11
.LVL4:
        .loc 1 5 1 is_stmt 0 view .LVU12
        pushq   %rax
        .cfi_def_cfa_offset 16
        .loc 1 12 5 view .LVU13
        call    abort
.LVL5:
        .loc 1 12 5 view .LVU14
        .cfi_endproc
.LFE13:
        .size   foo, .-foo
.Letext0:
...

Reply via email to