mc-imperial / dredd

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

Dredd mutates expressions in nested initializer list #295

Closed JonathanFoo0523 closed 1 month ago

JonathanFoo0523 commented 1 month ago

Applying dredd to

struct foo {
    short x;
    short y;
};

int main() {
    foo bar[] = {{1, 2}, {3, 4}};
}

mutate the intializer list to

{{__dredd_replace_expr_int_one(1, 0), __dredd_replace_expr_int_constant(2, 3)}, {__dredd_replace_expr_int_constant(3, 8), __dredd_replace_expr_int_constant(4, 13)}};

which result in compile-time error

error: non-constant-expression cannot be narrowed from type 'int' to 'short' in initializer list [-Wc++11-narrowing]

The nested initialiser list bypass fix #278