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

--- Comment #3 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
I'm not sure `-mtls-dialect=gnu2` is completely exempt from the bug. `$gcc -S
a.c -fPIC -o a.S -mtls-dialect=gnu2` shows this snippet:

```
bug:
.LFB2:
        .cfi_startproc
        subq    $24, %rsp
        .cfi_def_cfa_offset 32
        movl    $-1, %edi
        call    val
        testl   %eax, %eax
        je      .L14
        leaq    tv_cache@TLSDESC(%rip), %rax
        call    *tv_cache@TLSCALL(%rax)
        jg      .L16      ; <----------- is EGLAGS guaranteed to survive `call 
  *tv_cache@TLSCALL(%rax)`?
        movl    %fs:(%rax), %edi
        addq    $24, %rsp
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        jmp     use_cache
        .p2align 4,,10
        .p2align 3
.L16:
        .cfi_restore_state
        movl    $2, %edi
        movq    %rax, 8(%rsp)
        call    val
        movq    8(%rsp), %rdx
        testl   %eax, %eax
        je      .L14
        movl    %fs:(%rdx), %edi
        call    use_cache
.L14:
        ud2
```

Here `testl   %eax, %eax; ... ; jg      .L16` is interrupted by `call   
*tv_cache@TLSCALL(%rax)`. Does it guarantee to keep EFLAGS unmodified?

Reply via email to