From: Jakub Jelinek Date: Mon, 9 Mar 2020 20:52:18 +0000 (+0100) Subject: c++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81fa6d7321dd9b645d86de4a8a6967c603f176e3;p=gcc.git c++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067] Since r10-6527-gaaa26bf496a646778ac861aed124d960b5bf549f fold_for_warn will perform maybe_constant_value even on some cp_fold produced trees and so can include rotate exprs which were removed last fall from constexpr.c 2020-03-09 Jakub Jelinek PR c++/94067 Revert 2019-10-11 Paolo Carlini * constexpr.c (cxx_eval_constant_expression): Do not handle RROTATE_EXPR and LROTATE_EXPR. * g++.dg/warn/Wconversion-pr94067.C: New test. --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5fc3e7def6b..7b3b9560571 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2020-03-09 Jakub Jelinek + + PR c++/94067 + Revert + 2019-10-11 Paolo Carlini + + * constexpr.c (cxx_eval_constant_expression): Do not handle + RROTATE_EXPR and LROTATE_EXPR. + 2020-03-09 Marek Polacek PR c++/94050 - ABI issue with alignas on armv7hl. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 521c87f6210..76af0d710c4 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -5730,6 +5730,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, case MAX_EXPR: case LSHIFT_EXPR: case RSHIFT_EXPR: + case LROTATE_EXPR: + case RROTATE_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: case BIT_AND_EXPR: @@ -7853,6 +7855,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, case MAX_EXPR: case LSHIFT_EXPR: case RSHIFT_EXPR: + case LROTATE_EXPR: + case RROTATE_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: case BIT_AND_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c0fab65420..44f65ffa204 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-03-09 Jakub Jelinek + + PR c++/94067 + * g++.dg/warn/Wconversion-pr94067.C: New test. + 2020-03-09 Marek Polacek PR c++/94050 - ABI issue with alignas on armv7hl. diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-pr94067.C b/gcc/testsuite/g++.dg/warn/Wconversion-pr94067.C new file mode 100644 index 00000000000..c1031017a1f --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wconversion-pr94067.C @@ -0,0 +1,9 @@ +// PR c++/94067 +// { dg-do compile } +// { dg-options "-Wconversion" } + +static inline unsigned short +swap (unsigned short x) +{ + return (x >> 8) | static_cast(x << 8); +}