From: Marek Polacek <polacek@redhat.com>
To: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [C/C++ PATCH] Improve -Wlogical-op (PR c/63357)
Date: Wed, 22 Apr 2015 08:59:00 -0000 [thread overview]
Message-ID: <20150422085924.GE28950@redhat.com> (raw)
In-Reply-To: <55365C6E.1080100@gmail.com>
On Tue, Apr 21, 2015 at 04:19:26PM +0200, Manuel López-Ibáñez wrote:
> On 21/04/15 13:16, Marek Polacek wrote:
> >(-Wlogical-op still isn't enabled neither by -Wall nor by -Wextra.)
>
> The reason is https://gcc.gnu.org/PR61534
>
> which means we don't want to warn for:
>
> extern int xxx;
> #define XXX xxx
> int test (void)
> {
> if (!XXX && xxx)
> return 4;
> else
> return 0;
> }
>
> (gcc/testsuite/gcc.dg/pr40172-3.c, although it should be moved to c-c++-common)
>
> As noted in the PR: The problem is that !XXX becomes XXX == 0, but it has
> the location of "!", which is not virtual. If we look at the argument of the
> expression, then XXX is actually a var_decl, whose location corresponds to
> the declaration and not the use, and it is not virtual either. This is
> PR43486.
>
>
> >Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> Does it pass bootstrap if you enable it? That is, is GCC itself -Wlogical-op clean?
No, there are many issues e.g. in config/i386/i386.md exactly because of PR61534,
that is, with this patch, we warn even for
int var;
#define TARGET_64BIT var
#define TARGET_KEEPS_VECTOR_ALIGNED_STACK TARGET_64BIT
int
main ()
{
if (TARGET_64BIT || TARGET_KEEPS_VECTOR_ALIGNED_STACK)
return 1;
}
So the bug really must be solved first :(. I see I proposed a solution in the
PR, I wonder whether that works...
Marek
next prev parent reply other threads:[~2015-04-22 8:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 11:16 Marek Polacek
2015-04-21 14:19 ` Manuel López-Ibáñez
2015-04-22 8:59 ` Marek Polacek [this message]
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
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
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=20150422085924.GE28950@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=lopezibanez@gmail.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).