Re: [Late] F30 System-Wide Change proposal: GCC9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 29, 2019 at 01:56:19PM +0100, Jakub Jelinek wrote:
> On Tue, Jan 29, 2019 at 12:51:25PM +0000, Daniel P. Berrangé wrote:
> > Libvirt has hit a problem with -Wjump-misses-init newly reporting bogus
> > warnings for code using anonymous struct initializers during assignments:
> > 
> >   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89061
> >   https://bugzilla.redhat.com/show_bug.cgi?id=1669489
> > 
> > It is quite an ununfortunate bug as it is not straightforward to workaround
> > the bogus warning by changing code, while we also don't want to disable
> > -Wjump-misses-init since it is a useful/important warning in general.
> > So we'd really like to see the regression fixed before F30 GA.
> 
> That is not a false positive, you are crossing initialization of the
> compound literal.  Older GCC versions mistakenly haven't put the automatic
> variables for the compound literals into the right scope.

The variable was already initialized right at the start. The compound
literal is just a short-hand for later changing the values in several
fields of the struct at once. This is no different to manually assigning
new values to each individual field one at a time. eg

  struct demo demo = {0};

  ...some code with a goto...

  demo = (struct demo) { .cmd = "foo" };

is no different from

  struct demo demo = {0};

  ...some code with a goto...

  demo.cmd = "foo"

and neither should generate warnings about missing initializers with gotos.

> Yes, in your case you are not accessing the compound literal in the cleanup:
> code, but that is exactly the same case when you get a warning for:

Even if we were accessing the the variable in the cleanup code, it would
not be a missing initializer, as the variable was initialized at the time
it was declared before any goto.


>   if (whatever)
>     goto cleanup;
> 
>   int i = 26;
> 
> cleanup:
>   return 0;

This is a completely different scenario, as it is jumping over the
declaration of the variable and its only initializer.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux