public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
@ 2015-04-25 20:18 gerald at pfeifer dot com
2015-04-27 16:09 ` [Bug c/65891] " mpolacek at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: gerald at pfeifer dot com @ 2015-04-25 20:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Bug ID: 65891
Summary: -Wlogical-op now warns about logical ‘and’ of equal
expressions even when different types/sizeofs are
involved
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gerald at pfeifer dot com
CC: polacek at redhat dot com
Target Milestone: ---
Since 2015-04-21 Marek Polacek <polacek@redhat.com>
PR c/63357
* c-common.c (warn_logical_operator): Warn if the operands have the
same expressions.
we also diagnose code the following
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]);
}
with
input: In function ‘report’:
input:8:58: warning: logical ‘and’ of equal expressions [-Wlogical-op]
return (t < sizeof text_funcs / sizeof text_funcs[0] &&
^
when these two conditions are about two different types, defined in two
different locations, and the sizes are set differently.
>From gcc-bugs-return-484650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Apr 25 20:23:03 2015
Return-Path: <gcc-bugs-return-484650-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 20673 invoked by alias); 25 Apr 2015 20:23:03 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20644 invoked by uid 48); 25 Apr 2015 20:22:59 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/65891]=?UTF-8?Q? -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types?=/sizeofs are involved
Date: Sat, 25 Apr 2015 20:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc assigned_to target_milestone everconfirmed
Message-ID: <bug-65891-4-c9ZxiMzWJS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65891-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65891-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-04/txt/msg02202.txt.bz2
Content-length: 720
https://gcc.gnu.org/bugzilla/show_bug.cgi?ide891
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-04-25
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Target Milestone|--- |6.0
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Sorry. I'll look into that.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
@ 2015-04-27 16:09 ` mpolacek at gcc dot gnu.org
2015-04-27 17:26 ` ktietz at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-27 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|mpolacek at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
In the ML I wrote:
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
Thus unassigning for now.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
2015-04-27 16:09 ` [Bug c/65891] " mpolacek at gcc dot gnu.org
@ 2015-04-27 17:26 ` ktietz at gcc dot gnu.org
2022-01-03 20:10 ` [Bug c/65891] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-04-27 17:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktietz at gcc dot gnu.org
--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> ---
For C++ delayed folding this issue won't be warned anymore, as for it sizeof
isn't folded early.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [9/10/11/12 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
2015-04-27 16:09 ` [Bug c/65891] " mpolacek at gcc dot gnu.org
2015-04-27 17:26 ` ktietz at gcc dot gnu.org
@ 2022-01-03 20:10 ` pinskia at gcc dot gnu.org
2022-01-21 13:54 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 20:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |5.5.0
Known to fail| |6.1.0
Summary|-Wlogical-op now warns |[9/10/11/12 Regression]
|about logical ‘and’ of |-Wlogical-op now warns
|equal expressions even when |about logical ‘and’ of
|different types/sizeofs are |equal expressions even when
|involved |different types/sizeofs are
| |involved
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=63357
Target Milestone|--- |9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [9/10/11/12 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (2 preceding siblings ...)
2022-01-03 20:10 ` [Bug c/65891] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-21 13:54 ` rguenth at gcc dot gnu.org
2022-03-23 13:16 ` jlegg at feralinteractive dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |11.2.1
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [9/10/11/12 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (3 preceding siblings ...)
2022-01-21 13:54 ` rguenth at gcc dot gnu.org
@ 2022-03-23 13:16 ` jlegg at feralinteractive dot com
2022-05-27 9:35 ` [Bug c/65891] [10/11/12/13 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jlegg at feralinteractive dot com @ 2022-03-23 13:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
James Legg <jlegg at feralinteractive dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jlegg at feralinteractive dot com
--- Comment #7 from James Legg <jlegg at feralinteractive dot com> ---
(In reply to Kai Tietz from comment #3)
> For C++ delayed folding this issue won't be warned anymore, as for it sizeof
> isn't folded early.
With -fsanitize=integer-divide-by-zero, the spurious warning is still issued in
C++.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [10/11/12/13 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (4 preceding siblings ...)
2022-03-23 13:16 ` jlegg at feralinteractive dot com
@ 2022-05-27 9:35 ` rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [10/11/12/13 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (5 preceding siblings ...)
2022-05-27 9:35 ` [Bug c/65891] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:31 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug c/65891] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-07-19 12:57 ` [Bug c/65891] [12/13/14/15 " rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [11/12/13/14 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (6 preceding siblings ...)
2022-06-28 10:31 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:30 ` rguenth at gcc dot gnu.org
2024-07-19 12:57 ` [Bug c/65891] [12/13/14/15 " rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65891] [12/13/14/15 Regression] -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
` (7 preceding siblings ...)
2023-07-07 10:30 ` [Bug c/65891] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-07-19 12:57 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-07-19 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65891
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.5 |12.5
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11 branch is being closed.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-07-19 12:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 20:18 [Bug c/65891] New: -Wlogical-op now warns about logical ‘and’ of equal expressions even when different types/sizeofs are involved gerald at pfeifer dot com
2015-04-27 16:09 ` [Bug c/65891] " mpolacek at gcc dot gnu.org
2015-04-27 17:26 ` ktietz at gcc dot gnu.org
2022-01-03 20:10 ` [Bug c/65891] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-21 13:54 ` rguenth at gcc dot gnu.org
2022-03-23 13:16 ` jlegg at feralinteractive dot com
2022-05-27 9:35 ` [Bug c/65891] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug c/65891] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-07-19 12:57 ` [Bug c/65891] [12/13/14/15 " rguenth at gcc dot gnu.org
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).