[llvm-bugs] [Bug 39914] New: Incorrect code when right shifting signed int by more than its size

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 7 05:59:34 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39914

            Bug ID: 39914
           Summary: Incorrect code when right shifting signed int by more
                    than its size
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bugzilla at poradnik-webmastera.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

When signed int is shifted right by more than its width, results will be either
0 or -1. However clang always evaluates this as 0. Sample code below, compiled
with "-O3 -march=skylake-avx512".

[code]
void f();
void g();

void test(int n)
{
    if (n >> 222)
        f();
    else
        g();
}
[/code]

[asm]
test(int):                               # @test(int)
        jmp     g()                   # TAILCALL
[/asm]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181207/8e5159e2/attachment-0001.html>


More information about the llvm-bugs mailing list