[cfe-dev] request for comments on patch: detecting integer undefined behaviors

Eli Friedman eli.friedman at gmail.com
Sat Sep 4 22:46:40 PDT 2010


On Thu, Sep 2, 2010 at 3:19 PM, John Regehr <regehr at cs.utah.edu> wrote:
> Another draft of this patch is attached!

>From my previous review:

> +    if(CGF.rvOpTy->getScalarSizeInBits() == 32) {
> +      IntMin = llvm::ConstantInt::get(VMContext, CGF.APInt32Min);
> +      llvm::APInt APIntNegOne = llvm::APInt(32, -1, true);
> +      NegOne = llvm::ConstantInt::get(VMContext, APIntNegOne);
> +    }
> +    else if(CGF.rvOpTy->getScalarSizeInBits() == 64) {
> +      IntMin = llvm::ConstantInt::get(VMContext, CGF.APInt64Min);
> +      llvm::APInt APIntNegOne = llvm::APInt(64, -1, true);
> +      NegOne = llvm::ConstantInt::get(VMContext, APIntNegOne);
> +    }
>
> The if/else if shouldn't be necessary.

Other than that, I'm waiting for somone (probably Daniel) to review
the driver bits of the patch.

-Eli



More information about the cfe-dev mailing list