This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Informing gcc that a function initializes a pointer target
- From: Ian Lance Taylor <iant at google dot com>
- To: Ian Pilcher <arequipeno at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 11 Oct 2013 17:19:21 -0700
- Subject: Re: Informing gcc that a function initializes a pointer target
- Authentication-results: sourceware.org; auth=none
- References: <5258905F dot 4090903 at gmail dot com>
On Fri, Oct 11, 2013 at 4:57 PM, Ian Pilcher <arequipeno@gmail.com> wrote:
> I've run into a situation where I'm getting a spurious (I think) "may be
> used uninitialized" warning.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1018422
>
> In this case, the variable is initialized when its address is passed to
> another function.
>
> This situation made me wonder if there's some sort of function (or
> parameter) attribute that I could use to inform the compiler that the
> function does, in fact, initialize the variable.
This does look like a bug.
There is no need for such an attribute. When the compiler sees that a
pointer to the variable is passed to an unknown function, it assumes
that the variable has been initialized, which is really the only
reasonable behaviour.
Consider filing your bug report in the GCC bug queue, as described at
http://gcc.gnu.org/bugs/ . I have no idea what happens to GCC bugs
filed in the redhat bug queue.
Ian