From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
> Cc: = andrewjmoreton@gmail.com, emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sun, 17 Sep 2017 00:01:09 -0700
>
> Why was the attached patch needed? What warning did it suppress?
I wrote about that in
=C2=A0 http://lists.gnu.org/archi= ve/html/emacs-devel/2017-09/msg00448.html
The warning is this:
=C2=A0 ../../emacs/src/data.c: In function 'minmax_driver':
=C2=A0 ../../emacs/src/data.c:3022:9: warning: 'accum.i' may be use= d uninitialized in this function [-Wmaybe-uninitialized]
=C2=A0 return accum;
=C2=A0 ^~~~~
Which seems to mean that even eassume is sometimes not enough to
convince GCC 7 that the code is correct:
=C2=A0 static Lisp_Object
=C2=A0 minmax_driver (ptrdiff_t nargs, Lisp_Object *args,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enum Arith_Co= mparison comparison)
=C2=A0 {
=C2=A0 =C2=A0 eassume (0 < nargs);=C2=A0 <<<<<<<<= ;<<<<<<<<<<<<<<<
=C2=A0 =C2=A0 Lisp_Object accum;
=C2=A0 =C2=A0 for (ptrdiff_t argnum =3D 0; argnum < nargs; argnum++)
=C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Lisp_Object val =3D args[argnum];
=C2=A0 =C2=A0 =C2=A0 =C2=A0 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (argnum =3D=3D 0 || !NILP (arithcompare (val= , accum, comparison)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 accum =3D val;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (FLOATP (accum) && isnan (XFLOA= T_DATA (accum)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return accum;
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 return accum;
=C2=A0 }
Since nargs > 0, the loop is always entered, but GCC seems to miss that.=