Commit 0805d020 by Marek Polacek Committed by Marek Polacek

re PR c++/84171 (ICE with -Wsign-compare)

	PR c++/84171
	* c-warn.c (warn_for_sign_compare): Bail out if any of the operands
	is erroneous.

	* g++.dg/warn/Wsign-compare-8.C: New test.

From-SVN: r258147
parent 7299275f
2018-03-02 Marek Polacek <polacek@redhat.com>
PR c++/84171
* c-warn.c (warn_for_sign_compare): Bail out if any of the operands
is erroneous.
2018-03-02 Thomas Schwinge <thomas@codesourcery.com> 2018-03-02 Thomas Schwinge <thomas@codesourcery.com>
* c-attribs.c (c_common_attribute_table): Remove "cilk simd * c-attribs.c (c_common_attribute_table): Remove "cilk simd
......
...@@ -1931,6 +1931,9 @@ warn_for_sign_compare (location_t location, ...@@ -1931,6 +1931,9 @@ warn_for_sign_compare (location_t location,
tree op0, tree op1, tree op0, tree op1,
tree result_type, enum tree_code resultcode) tree result_type, enum tree_code resultcode)
{ {
if (error_operand_p (orig_op0) || error_operand_p (orig_op1))
return;
int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0)); int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1)); int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
int unsignedp0, unsignedp1; int unsignedp0, unsignedp1;
......
2018-03-02 Marek Polacek <polacek@redhat.com>
PR c++/84171
* g++.dg/warn/Wsign-compare-8.C: New test.
2018-03-02 Jakub Jelinek <jakub@redhat.com> 2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR c++/84662 PR c++/84662
......
// PR c++/84171
// { dg-options "-Wsign-compare" }
bool foo (char c)
{
const int i = 0 = 0; // { dg-error "lvalue" }
return c = i;
} // { dg-warning "control reaches" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment