[Bug c/89061] GCC 9 introduces false positive in -Wjump-misses-init

2019-01-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89061

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-01-29
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Jakub Jelinek  ---
Created attachment 45557
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45557=edit
gcc9-pr89061.patch

Untested patch that implements this.

[Bug c/89061] GCC 9 introduces false positive in -Wjump-misses-init

2019-01-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89061

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Joseph, you mean we should skip the compound literals from this warning because
if one doesn't take their address, they are used only directly in the code in
which they are referenced and not anywhere else, and if their address is taken,
there is probably no way to propagate that address through to after the label?
I mean, if I do:
  struct S *p = something;
  if (whatever)
goto l;
  p = &(struct S){ .a = 1, .b = 2, .c = 3 };
l:
  return p->b;
then although the initialization was crossed by the jump, nothing should be
able to find the address of the compound literal that got not initialized?

If yes, we don't have the complit decls marked specially in any way,
DECL_ARTIFICIAL && !DECL_NAME is way too generic check.  So we'd need some
unused C lang bit to mark it.

[Bug c/89061] GCC 9 introduces false positive in -Wjump-misses-init

2019-01-25 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89061

--- Comment #1 from joseph at codesourcery dot com  ---
Guessing this might be another issue from pushdecl being called for 
compound literals (r259641).

(Technically of course it's true that the jump misses the initialization 
of the anonymous object for the compound literal, that's just a useless 
warning.)