public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
@ 2015-06-17 14:45 miyuki at gcc dot gnu.org
2015-06-17 16:47 ` [Bug c++/66572] " manu at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-06-17 14:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
Bug ID: 66572
Summary: [6 Regression] Bogus Wlogical-op warning for operands
coming from template instantiations
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: miyuki at gcc dot gnu.org
Target Milestone: ---
Consider this example:
$ cat ./test.cc
struct false_type
{
static constexpr bool value = false;
};
struct true_type
{
static constexpr bool value = true;
};
template<typename T>
struct is_unsigned : false_type {};
template<>
struct is_unsigned<unsigned> : true_type {};
template<typename T1, typename T2>
bool foo()
{
return is_unsigned<T1>::value && is_unsigned<T2>::value;
}
int main()
{
foo<unsigned, unsigned>();
}
$ g++ -Wlogical-op -std=c++11 ./test.cc
./test.cc: In instantiation of 'bool foo() [with T1 = unsigned int; T2 =
unsigned int]':
./test.cc:25:29: required from here
./test.cc:20:35: warning: logical 'and' of equal expressions [-Wlogical-op]
return is_unsigned<T1>::value && is_unsigned<T2>::value;
IMHO GCC should not issue this warning: in this instantiation
(is_unsigned<unsigned>::value && is_unsigned<unsigned>::value) operator && is
indeed redundant, but that is not true for general case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
@ 2015-06-17 16:47 ` manu at gcc dot gnu.org
2015-06-17 18:00 ` miyuki at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2015-06-17 16:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-06-17
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Not idea how to fix it, but it seems logical that we should not warn. Why is it
a regression?
>From gcc-bugs-return-489221-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 17 16:55:40 2015
Return-Path: <gcc-bugs-return-489221-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14307 invoked by alias); 17 Jun 2015 16:55:40 -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 14246 invoked by uid 48); 17 Jun 2015 16:55:36 -0000
From: "gerhard.steinmetz.fortran@t-online.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66056] Segmentation fault for lonely label in type
Date: Wed, 17 Jun 2015 16:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: gerhard.steinmetz.fortran@t-online.de
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66056-4-Ch167tCark@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66056-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66056-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-06/txt/msg01553.txt.bz2
Content-length: 204
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf056
--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Hmm, there is always an ICE on my environment, for any used options.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
2015-06-17 16:47 ` [Bug c++/66572] " manu at gcc dot gnu.org
@ 2015-06-17 18:00 ` miyuki at gcc dot gnu.org
2015-06-18 1:05 ` miyuki at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-06-17 18:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
--- Comment #2 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #1)
> Why is it a regression?
Because GCC 5.1 and 4.9.2 do not issue such warning.
>From gcc-bugs-return-489230-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 17 18:00:01 2015
Return-Path: <gcc-bugs-return-489230-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31836 invoked by alias); 17 Jun 2015 18:00:01 -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 31786 invoked by uid 55); 17 Jun 2015 17:59:57 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/66429] ICE in expand_GOMP_SIMD_LAST_LANE
Date: Wed, 17 Jun 2015 18:00:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: ice-on-valid-code, openmp
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66429-4-vogrgSjj5C@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66429-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66429-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-06/txt/msg01562.txt.bz2
Content-length: 1521
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf429
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jun 17 17:59:25 2015
New Revision: 224568
URL: https://gcc.gnu.org/viewcvs?rev"4568&root=gcc&view=rev
Log:
PR middle-end/66429
* omp-low.c (expand_omp_taskreg): Use child_cfun instead of
DECL_STRUCT_FUNCTION (child_fn). Or in has_simduid_loops
and has_force_vectorize_loops flags from cfun into
child_cfun.
(expand_omp_simd): For broken loop, set cfun->has_simduid_loops
if simduid is non-NULL.
* tree-pass.h (make_pass_simduid_cleanup): New prototype.
* passes.def (pass_simduid_cleanup): Add new pass after loop
passes.
* tree-vectorizer.c (adjust_simduid_builtins): Remove one unnecessary
indirection from htab argument's type.
(shrink_simd_arrays): New function.
(vectorize_loops): Use it. Adjust adjust_simduid_builtins caller.
Don't call adjust_simduid_builtins if there are no loops.
(pass_data_simduid_cleanup, pass_simduid_cleanup): New variables.
(pass_simduid_cleanup::execute): New method.
(make_pass_simduid_cleanup): New function.
* c-c++-common/gomp/pr66429.c: New test.
Added:
trunk/gcc/testsuite/c-c++-common/gomp/pr66429.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/omp-low.c
trunk/gcc/passes.def
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-pass.h
trunk/gcc/tree-vectorizer.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
2015-06-17 16:47 ` [Bug c++/66572] " manu at gcc dot gnu.org
2015-06-17 18:00 ` miyuki at gcc dot gnu.org
@ 2015-06-18 1:05 ` miyuki at gcc dot gnu.org
2015-07-23 18:58 ` mpolacek at gcc dot gnu.org
2015-07-23 18:59 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-06-18 1:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
--- Comment #3 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Started with r222408. The commit message says:
PR c/63357
* c-common.c (warn_logical_operator): Warn if the operands have the same
expressions.
* doc/invoke.texi: Update description of -Wlogical-op.
Apperntly, the warning about same expressions in a logical expression was added
to Wlogical-op after GCC 5.1 release (I didn't know that) and it had this
problem from the very beginning.
In warn_logical_operator we have a check:
/* We do not warn for constants because they are typical of macro
expansions that test for features. */
if (CONSTANT_CLASS_P (op_left) || CONSTANT_CLASS_P (op_right))
return;
But in this case op_left and op_right are:
<var_decl 0x7ffff6118bd0 value
type <boolean_type 0x7ffff6263888 bool readonly public unsigned QI
size <integer_cst 0x7ffff610bf48 constant 8>
unit size <integer_cst 0x7ffff610bf60 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6263888 precision 1
min <integer_cst 0x7ffff612e1b0 0> max <integer_cst 0x7ffff612e1e0 1>>
I think it's still possible to fix this check to handle C++ boolean constants
properly (as if they were literal constants). But for general case we probably
must somehow know (e.g. add a new flag to enum tsubst_flags and pass it to
warn_logical_operator from build_new_op_1), that current expression depends on
template parameter.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
` (2 preceding siblings ...)
2015-06-18 1:05 ` miyuki at gcc dot gnu.org
@ 2015-07-23 18:58 ` mpolacek at gcc dot gnu.org
2015-07-23 18:59 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-07-23 18:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Jul 23 18:57:25 2015
New Revision: 226120
URL: https://gcc.gnu.org/viewcvs?rev=226120&root=gcc&view=rev
Log:
PR c++/66572
* pt.c (tsubst_copy_and_build): Add warn_logical_op sentinel.
* g++.dg/warn/Wlogical-op-2.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wlogical-op-2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/66572] [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
` (3 preceding siblings ...)
2015-07-23 18:58 ` mpolacek at gcc dot gnu.org
@ 2015-07-23 18:59 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-07-23 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66572
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-23 18:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 14:45 [Bug c++/66572] New: [6 Regression] Bogus Wlogical-op warning for operands coming from template instantiations miyuki at gcc dot gnu.org
2015-06-17 16:47 ` [Bug c++/66572] " manu at gcc dot gnu.org
2015-06-17 18:00 ` miyuki at gcc dot gnu.org
2015-06-18 1:05 ` miyuki at gcc dot gnu.org
2015-07-23 18:58 ` mpolacek at gcc dot gnu.org
2015-07-23 18:59 ` mpolacek 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).