[BUG] -Wuninitialized: initialize variable with itself
Alejandro Colomar
alx.manpages@gmail.com
Sun Nov 13 18:43:51 GMT 2022
Hi Andrew!
On 11/13/22 19:41, Andrew Pinski wrote:
> On Sun, Nov 13, 2022 at 10:40 AM Andrew Pinski <pinskia@gmail.com> wrote:
>>
>> On Sun, Nov 13, 2022 at 10:36 AM Alejandro Colomar via Gcc
>> <gcc@gcc.gnu.org> wrote:
>>>
>>> Hi,
>>>
>>> While discussing some idea for a new feature, I tested the following example
>>> program:
>>>
>>>
>>> int main(void)
>>> {
>>> int i = i;
>>> return i;
>>> }
>>
>> This is NOT a bug but a documented way of having the warning not being there.
>> See https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Warning-Options.html#index-Winit-self
>> https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Warning-Options.html#index-Wuninitialized
>> "If you want to warn about code that uses the uninitialized value of
>> the variable in its own initializer, use the -Winit-self option."
>
> I should note the main reason why I Know about this is because I fixed
> this feature years ago (at least for C front-end)
> and added the option to disable the feature.
I'm curious: what are the reasons why one would want to disable such a warning?
Why is it not in -Wall or -Wextra?
Thanks,
Alex
--
<http://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20221113/1a45180f/attachment.sig>
More information about the Gcc
mailing list