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

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

 



* Jakub Jelinek:

> 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.
> 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:

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


I think it's more like getting a warning for this:

    int i = 5;

    if (whatever)
      goto cleanup;
 
    i = 26;
    // …
 
  cleanup:
    return 0;

In fact, this results in warning, too:

    i = (struct { int value; }) { 26 }.value;

As Joseph pointed out on the upstream PR, the warning refers to the
internal variable used to store the compound literal, which the
programmer did not spell out explicitly.

I'm not sure if it is possible that the skipped initialization leads to
undefined behavior, without also involving a pointer to an object that
goes out of scope.

Thanks,
Florian
_______________________________________________
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