[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 14 10:34:13 GMT 2021


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

--- Comment #21 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Zoltan Vajda from comment #19)
> The problem does not only apply for conditional moves! I can turn on sse,
> for example.
> 
> https://gcc.godbolt.org/z/jP3Kne8T5
> 
> Then the problematic code with the conditional move disappears, but I have a
> similar speculative fld problem in another situation.
> 
> .L10:
>         inc     esi
>         cmp     edi, esi
>         jne     .L11
>         test    bl, bl                <= test input variable 'b'
>         fld     QWORD PTR [ebp-24]    <= load of (maybe) uninitialized
> 'result'
>         je      .L24                  <= jump based on value of 'b'

This one is fixed at least in gcc-10.

.L18:
        testb   %bl, %bl
        je      .L8
        fldl    -24(%ebp)
        addl    $20, %esp
        popl    %ebx


More information about the Gcc-bugs mailing list