From: Gary Hade <garyhade@us.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Lance Ortiz <lance.ortiz@hp.com>
Subject: Re: "unsigned expression < 0" always false warning
Date: Fri, 19 Apr 2013 13:43:04 -0700 [thread overview]
Message-ID: <20130419204304.GA28603@us.ibm.com> (raw)
In-Reply-To: <CAErSpo4YXcY9fuOKWYGDkddJwk68kmZTohsmVB6QvrhjboOh1Q@mail.gmail.com>
On Mon, Apr 15, 2013 at 11:17:31AM -0600, Bjorn Helgaas wrote:
> Can somebody help me resolve the following warning, please?
>
> $ make W=1 drivers/pci/pcie/aer/aerdrv_errprint.o
> ...
> CC drivers/pci/pcie/aer/aerdrv_errprint.o
> In file included from include/trace/ftrace.h:356:0,
> from include/trace/define_trace.h:86,
> from include/trace/events/ras.h:77,
> from drivers/pci/pcie/aer/aerdrv_errprint.c:27:
> include/trace/events/ras.h: In function ‘ftrace_define_fields_aer_event’:
> include/trace/events/ras.h:72:1: warning: comparison of unsigned
> expression < 0 is always false [-Wtype-limits]
>
> I think it's related to "status" being a u32 below (this is from
> include/trace/events/ras.h), but I don't know whether that's incorrect
> or how to fix it:
>
> TRACE_EVENT(aer_event,
> TP_PROTO(const char *dev_name,
> const u32 status,
> const u8 severity),
>
> TP_ARGS(dev_name, status, severity),
>
> TP_STRUCT__entry(
> __string( dev_name, dev_name )
> __field( u32, status )
> __field( u8, severity )
> ),
> ...
The culrpit is the is_signed_type macro defined in
include/linux/ftrace_event.h:
#define is_signed_type(type) (((type)(-1)) < (type)0)
The above
"__field( u32, status )"
gets expanded to
"ret = trace_define_field(event_call, "u32", "status", __builtin_offsetof(typeof(field),status), sizeof(field.status), (((u32)(-1)) < (u32)0), FILTER_OTHER); if (ret) return ret;"
The warning is triggered by:
"(((u32)(-1)) < (u32)0)"
which was put there by is_signed_type.
It appears that is_signed_type is simply taking advantage of the same
action that the compiler is warning about to perform it's function.
Not sure how to make is_signed_type warningless although
it does create a significant amount of noise during a full
`make W=1` kernel build. With 3.9-rc7 it appears to be
responsible for 1401 of 1476 occurrences of "warning: comparison
of unsigned expression < 0 is always false".
Gary
next prev parent reply other threads:[~2013-04-19 20:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 17:17 "unsigned expression < 0" always false warning Bjorn Helgaas
2013-04-19 20:43 ` Gary Hade [this message]
2013-04-19 21:05 ` Steven Rostedt
2013-04-19 21:17 ` Steven Rostedt
2013-04-19 22:30 ` Bjorn Helgaas
2013-04-19 22:45 ` Gary Hade
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=20130419204304.GA28603@us.ibm.com \
--to=garyhade@us.ibm.com \
--cc=bhelgaas@google.com \
--cc=fweisbec@gmail.com \
--cc=lance.ortiz@hp.com \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).