mc-imperial / dredd

Framework for evaluating C/C++ compiler testing tools
Apache License 2.0
11 stars 3 forks source link

Incorrect validation for binary arithmetic redundant condition #222

Closed khemichew closed 3 months ago

khemichew commented 3 months ago

Problem Dredd incorrectly checks the right operand twice instead of both the left and right operand when omitting redundant mutant generation:

https://github.com/mc-imperial/dredd/blob/11dac1f376eb960cf6dda4f4b04cd00bf69f3ebe/src/libdredd/src/mutation_replace_binary_operator.cc#L1058-L1065

Fix The first half of the validation condition should be:

(MutationReplaceExpr::ExprIsEquivalentToInt(*binary_operator_->getLHS(), 
                                                 0, ast_context) || 
      MutationReplaceExpr::ExprIsEquivalentToFloat(*binary_operator_->getLHS(), 
                                                   0.0, ast_context))