On 18/09/2025 00:23, Bruno Haible wrote:
Pádraig Brady wrote:
Note one can perturb the stack with gcc and clang at least
with the -ftrivial-auto-var-init=pattern option.
I've confirmed that it triggers a segfault on my Linux system
with this code issue.
It's lightweight, so I've added it in my default dev environment,
but it might be worth enabling on CI systems too?
-ftrivial-auto-var-init=pattern appears to initialize e.g.
an integer variable with 0xfefefefe always. This is deterministic.
Therefore, it will _reduce_, not increase, the probability that
I notice a given bug by looking at CI results.
A non-deterministic initialization is better for this purpose.
I think the pattern is chosen depending on base type and platform
to be as non usual/valid as possible.
Also as we've seen zero'd stacks are very common,
as we only noticed the coreutils bug¹ trigger on one of many systems.
I suppose the fixed pattern is chosen as a compromise
to be more likely to trigger bugs, but also avoid "heisenbug"s.
cheers,
Padraig
¹ https://github.com/coreutils/coreutils/commit/f4dcc2a49