public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jeff Law <law@redhat.com>
Cc: Gerald Pfeifer <gerald@pfeifer.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C/C++ PATCH] Improve -Wlogical-op (PR c/63357)
Date: Mon, 27 Apr 2015 16:10:00 -0000	[thread overview]
Message-ID: <20150427161008.GD8489@redhat.com> (raw)
In-Reply-To: <553E5E82.1020506@redhat.com>

On Mon, Apr 27, 2015 at 10:06:26AM -0600, Jeff Law wrote:
> On 04/27/2015 08:47 AM, Marek Polacek wrote:
> >On Sat, Apr 25, 2015 at 10:18:59PM +0200, Gerald Pfeifer wrote:
> >>In case this example feels too contrived (even though it is an
> >>excerpt of Wine code), we now also warn about the following where
> >>the two types and variables are defined in different places and
> >>the size of one is set implicitly:
> >>
> >>   typedef int r_fun_t (int);
> >>
> >>   r_fun_t * text_funcs[] = {0,0,0};
> >>
> >>   int report (unsigned t)
> >>   {
> >>     typedef int s_fun_t (long, char);
> >>
> >>     static s_fun_t * GUI_funcs[3];
> >>
> >>     return (t < sizeof text_funcs / sizeof text_funcs[0] &&
> >>             t < sizeof GUI_funcs / sizeof GUI_funcs[0]);
> >>   }
> >>
> >>(I also filed this as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
> >>so that we keep track.)
> >
> >I'm afraid there isn't an easy solution to this; the problem is that we fold
> >sizeof early, so the warning sees
> >
> >   t < sizeof 4 && t < 4
> >
> >and warns.  Maybe using SIZEOF_EXPR would help...
> Can you file a bug for this for future reference?  We may not tackle this
> specific issue in the current iteration of delayed folding, but it certainly
> helps to have BZs for specific issues that we'd like to fix once we can
> delay folding.

Gerald already opened PR65891 for this :).

	Marek

  reply	other threads:[~2015-04-27 16:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-25 20:19 Gerald Pfeifer
2015-04-27 14:47 ` Marek Polacek
2015-04-27 14:50   ` Marek Polacek
2015-04-27 16:06   ` Jeff Law
2015-04-27 16:10     ` Marek Polacek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-21 11:16 Marek Polacek
2015-04-21 14:19 ` Manuel López-Ibáñez
2015-04-22  8:59   ` Marek Polacek
2015-04-22  9:51     ` Manuel López-Ibáñez
2015-04-22  9:54       ` Manuel López-Ibáñez
2015-04-22 11:12       ` Marek Polacek
2015-04-23 22:02 ` Jeff Law

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=20150427161008.GD8489@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=law@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).