[Bug middle-end/85563] [8/9 regression] -Wmaybe-uninitialized false alarm regression with __builtin_unreachable and GCC 8

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 2 13:14:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85563

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Paul Eggert from comment #8)
> (In reply to Jakub Jelinek from comment #7)
> 
> > Or just rewrite whatever you are doing to something that doesn't suffer from
> > this.  Say:
> >   (tail) = Vframe_list;
> >   while ((frame1 = XCAR (tail), 1))
> >     {
> >       body...;
> >       tail = XCDR (tail);
> >       if (!CONSP (tail))
> >         break;
> >     }
> 
> Unfortunately that wouldn't be right, since Vframe_list might be Qnil so the
> first XCAR would be invalid.

I don't understand that.  You had:
  ((CONSP (Vframe_list)) ? (void) 0 : __builtin_unreachable ());
  for ((tail) = Vframe_list; (CONSP (tail) && (frame1 = XCAR (tail), 1)); tail
= XCDR (tail))
    body...;
so, the assertion is testing what the CONSP will test on the first iteration.
So, if Qnil fails CONSP test, then it would fail the assertion, if it doesn't,
then the first iteration is done unconditionally.


More information about the Gcc-bugs mailing list