commit 1448724dc8d932cb954e2910639106ee0b3f1406
parent fb4ba8fbc3b6a16658a37b59b2f227ccf1781983
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 30 Mar 2026 14:29:20 -0700
tests/cc: Initialize struct in 0231-init before reading it
C allows for int to have non-value (trap) representations. Since
`a` is not initialized, it's value is indeterminate and may be a
non-value representation, in which case reading it to initialize
`aa` is undefined behavior.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/cc/execute/0231-init.c b/tests/cc/execute/0231-init.c
@@ -4,7 +4,7 @@ struct a {
int main()
{
- struct a a;
+ struct a a = {2};
struct a aa = a;
return 0;