From bcdef9ea714e43f53111374c8a83862e7d98047d Mon Sep 17 00:00:00 2001 From: Andrey Shishpanov Date: Fri, 21 Aug 2015 19:42:58 +0300 Subject: [PATCH] added unsafe case of division with "all off" mask --- ast.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ast.cpp b/ast.cpp index ca465571..d858c371 100644 --- a/ast.cpp +++ b/ast.cpp @@ -420,6 +420,13 @@ lCheckAllOffSafety(ASTNode *node, void *data) { return false; } + if (llvm::dyn_cast(node) != NULL) { + BinaryExpr* binaryExpr = llvm::dyn_cast(node); + if (binaryExpr->op == BinaryExpr::Mod || binaryExpr->op == BinaryExpr::Div) { + *okPtr = false; + return false; + } + } IndexExpr *ie; if ((ie = llvm::dyn_cast(node)) != NULL && ie->baseExpr != NULL) { const Type *type = ie->baseExpr->GetType();