On 9/9/25 21:41, Jakub Jelinek wrote:
On Tue, Sep 09, 2025 at 09:32:41PM +0200, Harald Anlauf wrote:
Running the related tests under valgrind did not reveal anything.
The maybe-uninitialized errors are bogus.
They aren't, because the compiler doesn't know that those 17 or how many
calls in between
switch (code->resolved_isym->id)
and
if (code->resolved_isym->id == GFC_ISYM_FSTAT)
later on don't change code->resolved_isym or code->resolved_isym->id
(which is passed to the function, so escaped, any function compiler doesn't
know anything about could have access to that through global variables in
theory).
Oh. Coming from Fortran, I did not consider that anyone would write
such code (except when doing I/O or communication)...
I think if the code did
auto id = code->resolved_isym->id;
switch (id)
{
case GFC_ISYM_FSTAT:
...
break;
case GFC_ISYM_LSTAT:
case GFC_ISYM_STAT:
...
break;
default:
gcc_unreachable ();
}
...
switch (id)
...
if (id == GFC_ISYM_FSTAT)
tmp = build_call_expr_loc (input_location, tmp, 3, unit, vals,
stat ? arg3 : null_pointer_node);
else
tmp = build_call_expr_loc (input_location, tmp, 4, name, vals,
stat ? arg3 : null_pointer_node, slen);
then it wouldn't have the uninit warnings.
Jakub
I see. The corresponding patch would have been slightly longer...