From: Dean Nelson <dcn@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] eliminate compiler warning for xpc_channel.c
Date: Tue, 04 Apr 2006 15:29:17 +0000 [thread overview]
Message-ID: <20060404152917.GA30014@sgi.com> (raw)
In-Reply-To: <44327C95.mailxM9N11TC7P@aqua.americas.sgi.com>
On Tue, Apr 04, 2006 at 07:34:08AM -0700, Luck, Tony wrote:
> >> Did you mean to say "*msg = NULL"?
> >
> > this is actually an ANSI-permitted idiom for shutting up compiler
> > warnings while not actually initialising the variable.
>
> So I learned something new today!
>
> But then this patch is wrong ... it shuts the compiler up
> and leaves 4 ways that xpc_allocate_msg() can return without doing
> the initialization, so that msg will be used uninitialized.
You are correct: "*msg = NULL" is the right answer.
The compiler being used is: "gcc (GCC) 4.1.0 (SUSE Linux)".
In the past when I've seen complier warnings of this nature, it usually
(but not always) turned out that the compiler was unable to 'see' that
things were really okay. In this particular case, I hadn't seen this
warning until just yesterday (my build machine was just updated a few
days ago), and since nothing in this area of the code had changed for
some time now, I just assumed that the compiler was not seeing things
properly. It didn't occur to me that xpc_allocate_msg() was possibly
being inlined and thus the compiler was giving a correct warning that
should not be ignored.
Do you want a new patch, or are you comfortable with switching the
'msg' to a 'NULL'?
Thanks for looking more closely than I obviously did.
Dean
next prev parent reply other threads:[~2006-04-04 15:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-04 14:03 [PATCH] eliminate compiler warning for xpc_channel.c Dean Nelson
2006-04-04 14:23 ` Luck, Tony
2006-04-04 14:27 ` Matthew Wilcox
2006-04-04 14:34 ` Luck, Tony
2006-04-04 15:29 ` Dean Nelson [this message]
2006-04-04 15:35 ` Luck, Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060404152917.GA30014@sgi.com \
--to=dcn@sgi.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox