[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master a99ba59aa02: ; * src/pdumper.c (dump_do_fixup): Pacify GCC.
From: |
Eli Zaretskii |
Subject: |
Re: master a99ba59aa02: ; * src/pdumper.c (dump_do_fixup): Pacify GCC. |
Date: |
Thu, 30 Jan 2025 12:39:37 +0200 |
> Date: Thu, 30 Jan 2025 09:58:49 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Stefan Kangas <stefankangas@gmail.com>,
> Paul Eggert <eggert@cs.ucla.edu>
>
> "Eli Zaretskii" <eliz@gnu.org> writes:
>
> > branch: master
> > commit a99ba59aa02ef8cfd314737950b6cd8d97015925
> > Author: Eli Zaretskii <eliz@gnu.org>
> > Commit: Eli Zaretskii <eliz@gnu.org>
> >
> > ; * src/pdumper.c (dump_do_fixup): Pacify GCC.
>
> > ---
> > src/pdumper.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/pdumper.c b/src/pdumper.c
> > index 9f0447eb5aa..bfa790b963a 100644
> > --- a/src/pdumper.c
> > +++ b/src/pdumper.c
> > @@ -3990,7 +3990,7 @@ dump_do_fixup (struct dump_context *ctx,
> > Lisp_Object arg = dump_pop (&fixup);
> > eassert (NILP (fixup));
> > dump_seek (ctx, dump_fixup_offset);
> > - intptr_t dump_value;
> > + intptr_t dump_value UNINIT;
>
> Can we please stop rewriting every single switch statement again and
> again, each time attempting to solve one problem which will make
> another, worse one, pop up instead?
The above commit didn't rewrite the switch, it just shuts up the
compiler which evidently cannot figure out that dump_value is not
initialized only in the cases where dump_write is false, which means
dump_write is not called, and the value of dump_value is not used.
> UNINIT, IMHO, is to be used in situations where GCC fails to discover
> that a code path to a usage of the variable lacking an initializer is
> impossible.
That's the situation here.
> This is a very different case. By removing the default case in the
> switch statement, we made the code path which falls through the switch
> statement without initializing dump_value reachable. There's not even a
> hint to the compiler that this is an unlikely code path, so the
> resulting code will be significantly worse than what would have been
> possible before.
The default case was removed before the above commit, and not by me.
> Can we please just go back to the "default: emacs_abort();" we had
> before?
I don't mind going back. Stefan?