diff options
author | Robin Morisset <morisset@google.com> | 2014-10-07 23:53:57 +0000 |
---|---|---|
committer | Robin Morisset <morisset@google.com> | 2014-10-07 23:53:57 +0000 |
commit | 880580b88f9deed575104168e85f242401f8a92e (patch) | |
tree | d8f8e2f2a3e94cdae99b46da55d905c244835e10 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 845bb3c2fdf4a370c706165f62804eff82f3e88d (diff) | |
download | llvm-880580b88f9deed575104168e85f242401f8a92e.zip llvm-880580b88f9deed575104168e85f242401f8a92e.tar.gz llvm-880580b88f9deed575104168e85f242401f8a92e.tar.bz2 |
[X86] Fix a bug with fetch_add(INT32_MIN)
Summary:
Fix pr21099
The pseudocode of what we were doing (spread through two functions) was:
if (operand.doesNotFitIn32Bits())
Opc.initializeWithFoo();
if (operand < 0)
operand = -operand;
if (operand.doesFitIn8Bits())
Opc.initializeWithBar();
else if (operand.doesFitIn32Bits())
Opc.initializeWithBlah();
doStuff(Opc);
So for operand == INT32_MIN, Opc was never initialized because the operand changes
from fitting in 32 bits to not fitting, causing the various bugs/error messages
noted by pr21099.
This patch adds an extra test at the beginning for this case, and an
llvm_unreachable to have better error message if the operand ends up
not fitting in 32-bits at the end.
Test Plan: new test + make check
Reviewers: jfb
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5655
llvm-svn: 219257
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions