• bryleun's avatar
    S390: Fixed s390 simulation check for underflow in subtraction. · 0d24a0fc
    bryleun authored
    Clang optimizes away CheckOverflowForIntSub at any opt
    level (includes -O1, -O2, -O3) into a false statement,
    resulting in incorrect values being returned. As the C++
    standard considers overflows to be undefined behaviour,
    this is technically correct as compilers can assume that
    overflows never occur, but problematic in our case (where
    overflows do occur, and a specific result is expected).
    
    This change replaces the original check with a call to a
    function that is optimized in a manner that returns correct output.
    
    R=michael_dawson@ca.ibm.com,jyan@ca.ibm.com,mtbrandyberry@ca.ibm.com,joransiu@ca.ibm.com,danno@chromium.org,jkummerow@chromium.org,jochen@chromium.org
    
    BUG=
    
    Review URL: https://codereview.chromium.org/1826043002
    
    Cr-Commit-Position: refs/heads/master@{#35082}
    0d24a0fc
simulator-s390.cc 172 KB