diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/pr84341.c | 10 |
4 files changed, 29 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2f12a35..c2b19d8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-12 Jakub Jelinek <jakub@redhat.com> + + PR c++/84341 + * parser.c (cp_parser_binary_expression): Use build_min instead of + build2_loc to build the no_toplevel_fold_p toplevel binary expression. + 2018-02-12 Nathan Sidwell <nathan@acm.org> PR c++/84263 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e1e8741..9a05e4f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9330,12 +9330,14 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, if (no_toplevel_fold_p && lookahead_prec <= current.prec && sp == stack) - current.lhs = build2_loc (combined_loc, - current.tree_type, - TREE_CODE_CLASS (current.tree_type) - == tcc_comparison - ? boolean_type_node : TREE_TYPE (current.lhs), - current.lhs, rhs); + { + current.lhs + = build_min (current.tree_type, + TREE_CODE_CLASS (current.tree_type) == tcc_comparison + ? boolean_type_node : TREE_TYPE (current.lhs), + current.lhs.get_value (), rhs.get_value ()); + SET_EXPR_LOCATION (current.lhs, combined_loc); + } else { current.lhs = build_x_binary_op (combined_loc, current.tree_type, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a384383..4026175 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-12 Jakub Jelinek <jakub@redhat.com> + + PR c++/84341 + * c-c++-common/gomp/pr84341.c: New test. + 2018-02-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/68746 diff --git a/gcc/testsuite/c-c++-common/gomp/pr84341.c b/gcc/testsuite/c-c++-common/gomp/pr84341.c new file mode 100644 index 0000000..557f1ba --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr84341.c @@ -0,0 +1,10 @@ +/* PR c++/84341 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int i) +{ + #pragma omp atomic + i = &i + 1; /* { dg-error "invalid form of" } */ +} |