mc-imperial / dredd

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

Avoid equivalent mutation to unsigned int #240

Open JonathanFoo0523 opened 2 months ago

JonathanFoo0523 commented 2 months ago

Currently, for unsigned integer a, Dredd allow the mutation:

a != 0

to

a > 0

Both expressions are equivalent. Since Dredd has the type information when traversing the AST, it should be possible to disallow such mutation.

afd commented 1 month ago

Do not perform the following mutations:

Am I missing anything else @JonathanFoo0523 @JamesLee-Jones?

JamesLee-Jones commented 1 month ago

Do not perform the following mutations:

  • a != 0 -> a > 0
  • 0 != a -> 0 < a
  • a op 0 -> a < 0 (subsumed by false)
  • 0 op a -> 0 > a (subsumed by false)
  • a op 0 -> a >= 0 (subsumed by true)
  • 0 op a -> a <= 0 (subsumed by true)

Am I missing anything else @JonathanFoo0523 @JamesLee-Jones?

Also:

a == 0 -> a <= 0 (equivalent) 0 == a -> 0 >= a (equivalent)