mc-imperial / dredd

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

Fix int_32 overflow issue which incorrectly apply multiple mutations when only one is enabled #256

Closed JonathanFoo0523 closed 1 month ago

JonathanFoo0523 commented 1 month ago

The GetRegularDreddPreludeCpp and GetRegularDreddPreludeC functions have been modified with the following changes:

(a) The return type is now bool instead of int. If the return expression is of type uint64_t, returning an int could truncate the value. By returning a bool, the result will be 0 if the value compares equal to 0; otherwise, the result will be 1. (b) Any int literal involved in a bit shift operation is explicitly cast to uint64_t.

Additionally, we have added a test that check that aims to detect this bugs comparing execution output in test/execute/bit_overflow_c and test/execute/bit_overflow_c.

This PR attempts to fix issue 230.