Dredd mutates identical source files differently in two directories with same compilation database #338
Description
I encountered a problem where Dredd mutates the same source file differently in two directories with the same content but different directory names. The compilation database is generated in the same way for both directories and should be identical, except for references to the directory name. Dredd is applied in default mode (not using mutant tracking) to the same source file from the two different directories, and each is supplied with its own compilation database (which should only differ in the directory name references).
The reduced program (excluding several headers) is shown below. When applying Dredd to this code:
void a () {
if (1) HOST_WIDE_INT_M1U;
}
the if-stmt is mutated differently in the two directories:
if (!__dredd_enabled_mutation(6)) { if (__dredd_replace_expr_bool_true(1, 0)) __dredd_replace_expr_unsigned_long_constant(__dredd_replace_expr_unsigned_long_one(HOST_WIDE_INT_M1U, 1), 3); }
compared to
if (!__dredd_enabled_mutation(3)) { if (__dredd_replace_expr_bool_true(1, 0)) __dredd_replace_expr_unsigned_long_one(HOST_WIDE_INT_M1U, 1); }
This is strange because the AST generated by Dredd when mutating the source file is identical, aside from the directory name.
`-FunctionDecl 0x5566ffe12e98 <../../gcc-14.1.0-mutated/gcc/tree-ssa-strlen.cc:12:1, line:14:1> line:12:6 a 'void ()'
`-CompoundStmt 0x5566ffe12fd0 <col:11, line:14:1>
`-IfStmt 0x5566ffe12fb0 <line:13:3, <scratch space>:188:1>
|-ImplicitCastExpr 0x5566ffe12f60 <../../gcc-14.1.0-mutated/gcc/tree-ssa-strlen.cc:13:7> 'bool' <IntegralToBoolean>
| `-IntegerLiteral 0x5566ffe12f40 <col:7> 'int' 1
`-UnaryOperator 0x5566ffe12f98 <../../gcc-14.1.0-mutated/gcc/hwint.h:72:45, <scratch space>:188:1> 'unsigned long' prefix '-'
`-IntegerLiteral 0x5566ffe12f78 <col:1> 'unsigned long' 1
compared to
`-FunctionDecl 0x557f36add5c8 <../../gcc-14.1.0-mutant-tracking/gcc/tree-ssa-strlen.cc:12:1, line:14:1> line:12:6 a 'void ()'
`-CompoundStmt 0x557f36add700 <col:11, line:14:1>
`-IfStmt 0x557f36add6e0 <line:13:3, <scratch space>:5:1>
|-ImplicitCastExpr 0x557f36add690 <../../gcc-14.1.0-mutant-tracking/gcc/tree-ssa-strlen.cc:13:7> 'bool' <IntegralToBoolean>
| `-IntegerLiteral 0x557f36add670 <col:7> 'int' 1
`-UnaryOperator 0x557f36add6c8 <../../gcc-14.1.0-mutant-tracking/gcc/hwint.h:72:45, <scratch space>:5:1> 'unsigned long' prefix '-'
`-IntegerLiteral 0x557f36add6a8 <col:1> 'unsigned long' 1
Let me know if there's anything else I should try to debug the issue.