From cd4a7dec3f6679ed40a949c9e4d6891bfec84889 Mon Sep 17 00:00:00 2001 From: tapplencourt Date: Tue, 4 Aug 2026 00:15:29 +0000 Subject: [PATCH] itt: emit `= {0}` instead of `= {}` for _retval `Type _retval = {};` is an empty initializer, which is only valid for scalars from C23 on; older compilers reject it with "empty scalar initializer" (gcc 12 does, gcc 13 accepts it, which is why CI never caught this). `= {0}` zero-initializes both scalars and aggregates and is valid well before C23, so it keeps _retval initialized -- it is read by the tracepoint before being assigned -- without the dialect requirement. Co-Authored-By: Claude Opus 4.8 --- backends/itt/gen_itt.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backends/itt/gen_itt.rb b/backends/itt/gen_itt.rb index 9e3c4463d..de130ff70 100644 --- a/backends/itt/gen_itt.rb +++ b/backends/itt/gen_itt.rb @@ -9,7 +9,9 @@ if c.type.is_a?(YAMLCAst::Pointer) "#{c.type} _retval = calloc(1, sizeof(*_retval));" else - "#{c.type} _retval = {};" + # `= {}` is C23, so use `= {0}` which also works for scalars + # pre-C23. Can be modernized once we require C23. + "#{c.type} _retval = {0};" end) register_epilogue(c.name, 'return _retval;')