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: unassignedclangb...@nondot.org
          Reporter: bugzi...@poradnik-webmastera.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to