aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-02-12 23:25:41 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-02-12 23:25:41 +0100
commitd69aeeeed06b0fe5567f04343cf7a8a7aa3e26f5 (patch)
treedc6192333e804891ba2cb1526f35b64aaac75a37 /gcc/cp/parser.c
parent2b0dfc8429f6f0fcd82487ed8dc2a6db578e26f4 (diff)
downloadgcc-d69aeeeed06b0fe5567f04343cf7a8a7aa3e26f5.zip
gcc-d69aeeeed06b0fe5567f04343cf7a8a7aa3e26f5.tar.gz
gcc-d69aeeeed06b0fe5567f04343cf7a8a7aa3e26f5.tar.bz2
re PR c++/84341 (ICE with #pragma omp atomic)
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. * c-c++-common/gomp/pr84341.c: New test. From-SVN: r257607
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c14
1 files changed, 8 insertions, 6 deletions
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,