Commit 889a3a30 by Marek Polacek Committed by Marek Polacek

re PR c++/85045 (ICE+SIGILL on valid C++ code: …

re PR c++/85045 (ICE+SIGILL on valid C++ code:  cxx_pretty_printer::postfix_expression(tree_node*) (), at  cp/cxx-pretty-print.c:482)

	PR c++/85045
	* c-pretty-print.c (c_pretty_printer::multiplicative_expression)
	<case RDIV_EXPR>: Tweak condition.

	* cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
	Handle EXACT_DIV_EXPR and RDIV_EXPR.  Tweak condition.
	(cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.

	* g++.dg/cpp0x/Wnarrowing5.C: New test.
	* gcc.dg/pr85045.c: New test.

From-SVN: r258804
parent 50531a2a
2018-03-23 Marek Polacek <polacek@redhat.com>
PR c++/85045
* c-pretty-print.c (c_pretty_printer::multiplicative_expression)
<case RDIV_EXPR>: Tweak condition.
2018-03-20 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (pp_ada_tree_identifier): Deal specifically with _Bool.
......
......@@ -1841,7 +1841,7 @@ c_pretty_printer::multiplicative_expression (tree e)
pp_c_whitespace (this);
if (code == MULT_EXPR)
pp_c_star (this);
else if (code == TRUNC_DIV_EXPR)
else if (code != TRUNC_MOD_EXPR)
pp_slash (this);
else
pp_modulo (this);
......
2018-03-23 Marek Polacek <polacek@redhat.com>
PR c++/85045
* cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
(cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
Implement P0962
......
......@@ -899,11 +899,13 @@ cxx_pretty_printer::multiplicative_expression (tree e)
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
case EXACT_DIV_EXPR:
case RDIV_EXPR:
multiplicative_expression (TREE_OPERAND (e, 0));
pp_space (this);
if (code == MULT_EXPR)
pp_star (this);
else if (code == TRUNC_DIV_EXPR)
else if (code != TRUNC_MOD_EXPR)
pp_slash (this);
else
pp_modulo (this);
......@@ -1113,6 +1115,8 @@ cxx_pretty_printer::expression (tree t)
case MULT_EXPR:
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
case EXACT_DIV_EXPR:
case RDIV_EXPR:
multiplicative_expression (t);
break;
......
......@@ -3,6 +3,10 @@
PR c++/85033
* g++.dg/ext/builtin-offsetof2.C: New test.
PR c++/85045
* g++.dg/cpp0x/Wnarrowing5.C: New test.
* gcc.dg/pr85045.c: New test.
2018-03-23 Eric Botcazou <ebotcazou@adacore.com>
PR debug/85020
......
// PR c++/85045
// { dg-do compile { target c++11 } }
typedef struct tt {
unsigned short h;
} tt;
void mainScreen(float a)
{
tt numlrect = {int(100/a)}; // { dg-error "narrowing conversion" }
}
/* PR c/85045 */
/* { dg-do compile } */
/* { dg-options "-fno-diagnostics-show-caret" } */
void
f (double a, double b)
{
(a / b) (); /* { dg-error "called object .a / b. is not a function or function pointer" } */
}
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