This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: invalid "may be used uninitialized" warning with g++ current
- From: Andrew Haley <aph at redhat dot com>
- To: Дмитрий Дьяченко <dimhen at gmail dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 05 Feb 2009 09:49:29 +0000
- Subject: Re: invalid "may be used uninitialized" warning with g++ current
- References: <c534783a0902041318s73f0b29cm92eaba332ac272ec@mail.gmail.com> <de8d50360902041324o3f84575fga98d860c1517b9c3@mail.gmail.com> <c534783a0902041350h44b2ba16s87ace9f74cea4ef8@mail.gmail.com>
Дмитрий Дьяченко wrote:
> 2009/2/5 Andrew Pinski <pinskia@gmail.com>:
>> On Wed, Feb 4, 2009 at 1:18 PM, Дмитрий Дьяченко <dimhen@gmail.com> wrote:
>>> The following code
>>>
>>> int bar(int *global)
>>> {
>>> int local;
>>> if(&local != global)
>>> return 0;
>>> return local;
>>> }
>> The issue is that GCC does not figure that global cannot point to
>> local so it does not optimize away the if statement.
> Sorry, but I don't understood - is it impossible to fix, so there are
> no needs in bug report?
> Or PR about this issue already exists?
> Or it's not a bug?
It's not a bug. gcc is warning you that the return statement may use an
uninitialized local. It does, so there is not a bug. The fact that the
return statement isn't reachable doesn't imply that there should be no
warning.
Andrew.