Thread View: gmane.comp.gcc.patches
3 messages
3 total messages
Started by Jakub Jelinek
Tue, 18 Mar 2014 16:16
[C++ PATCH] Fix -std=c++11 OpenMP UDR handling (PR c++/60331)
Author: Jakub Jelinek
Date: Tue, 18 Mar 2014 16:16
Date: Tue, 18 Mar 2014 16:16
122 lines
4361 bytes
4361 bytes
Hi! Apparently with -std=c++11 and higher, if in a template we call finish_expr_stmt on a DECL_EXPR (as cp_parser_omp_declare_reduction_exprs does) and the omp_priv var in there is not type dependent, it ICEs during: else if (!type_dependent_expression_p (expr)) convert_to_void (build_non_dependent_expr (expr), ICV_STATEMENT, tf_warning_or_error); So, the patch in that case just does the rest of what finish_expr_stmt performs. Jason, do you have better ideas how to fix this? The patch has been bootstrapped/regtested on x86_64-linux and i686-linux. 2014-03-18 Jakub Jelinek <jakub@redhat.com> PR c++/60331 * parser.c (cp_parser_omp_declare_reduction_exprs): Avoid calling finish_expr_stmt on DECL_EXPRs in templates. * testsuite/libgomp.c++/udr-11.C: New test. * testsuite/libgomp.c++/udr-12.C: New test. * testsuite/libgomp.c++/udr-13.C: New test. * testsuite/libgomp.c++/udr-14.C: New test. * testsuite/libgomp.c++/udr-15.C: New test. * testsuite/libgomp.c++/udr-16.C: New test. * testsuite/libgomp.c++/udr-17.C: New test. * testsuite/libgomp.c++/udr-18.C: New test. * testsuite/libgomp.c++/udr-19.C: New test. --- gcc/cp/parser.c.jj 2014-03-18 10:04:14.000000000 +0100 +++ gcc/cp/parser.c 2014-03-18 11:18:44.511571459 +0100 @@ -30698,7 +30698,22 @@ cp_parser_omp_declare_reduction_exprs (t block = finish_omp_structured_block (block); cp_walk_tree (&block, cp_remove_omp_priv_cleanup_stmt, omp_priv, NULL); - finish_expr_stmt (block); + if (block + && TREE_CODE (block) == DECL_EXPR + && processing_template_decl) + { + if (check_for_bare_parameter_packs (block)) + block = error_mark_node; + if (TREE_CODE (block) != CLEANUP_POINT_EXPR) + { + if (TREE_CODE (block) != EXPR_STMT) + block = build_stmt (input_location, EXPR_STMT, block); + block = maybe_cleanup_point_expr_void (block); + } + add_stmt (block); + } + else + finish_expr_stmt (block); if (ctor) add_decl_expr (omp_orig); --- libgomp/testsuite/libgomp.c++/udr-11.C.jj 2014-03-18 11:47:43.326846415 +0100 +++ libgomp/testsuite/libgomp.c++/udr-11.C 2014-03-18 11:47:43.329846576 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-1.C" --- libgomp/testsuite/libgomp.c++/udr-12.C.jj 2014-03-18 11:47:43.330846623 +0100 +++ libgomp/testsuite/libgomp.c++/udr-12.C 2014-03-18 11:47:43.331846666 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-2.C" --- libgomp/testsuite/libgomp.c++/udr-13.C.jj 2014-03-18 11:47:43.332846707 +0100 +++ libgomp/testsuite/libgomp.c++/udr-13.C 2014-03-18 11:47:43.332846707 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-3.C" --- libgomp/testsuite/libgomp.c++/udr-14.C.jj 2014-03-18 11:47:43.333846744 +0100 +++ libgomp/testsuite/libgomp.c++/udr-14.C 2014-03-18 11:47:43.334846777 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-4.C" --- libgomp/testsuite/libgomp.c++/udr-15.C.jj 2014-03-18 11:47:43.334846777 +0100 +++ libgomp/testsuite/libgomp.c++/udr-15.C 2014-03-18 11:47:43.335846809 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-5.C" --- libgomp/testsuite/libgomp.c++/udr-16.C.jj 2014-03-18 11:47:43.336846840 +0100 +++ libgomp/testsuite/libgomp.c++/udr-16.C 2014-03-18 11:47:43.336846840 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-6.C" --- libgomp/testsuite/libgomp.c++/udr-17.C.jj 2014-03-18 11:47:43.337846867 +0100 +++ libgomp/testsuite/libgomp.c++/udr-17.C 2014-03-18 11:47:43.337846867 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-7.C" --- libgomp/testsuite/libgomp.c++/udr-18.C.jj 2014-03-18 11:47:43.338846892 +0100 +++ libgomp/testsuite/libgomp.c++/udr-18.C 2014-03-18 11:47:43.338846892 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-8.C" --- libgomp/testsuite/libgomp.c++/udr-19.C.jj 2014-03-18 11:47:43.339846916 +0100 +++ libgomp/testsuite/libgomp.c++/udr-19.C 2014-03-18 11:47:43.339846916 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-9.C" Jakub
Re: [C++ PATCH] Fix -std=c++11 OpenMP UDR handling (PR c++/60331)
Author: Jason Merrill
Date: Mon, 24 Mar 2014 14:02
Date: Mon, 24 Mar 2014 14:02
8 lines
245 bytes
245 bytes
On 03/18/2014 11:16 AM, Jakub Jelinek wrote: > Jason, do you have better ideas how to fix this? Better would be to return false from potential_constant_expression_1 for DECL_EXPR; just add another case to the various _STMT tree codes. Jason
Re: [C++ PATCH] Fix -std=c++11 OpenMP UDR handling (PR c++/60331)
Author: Jakub Jelinek
Date: Tue, 25 Mar 2014 10:31
Date: Tue, 25 Mar 2014 10:31
102 lines
3635 bytes
3635 bytes
On Mon, Mar 24, 2014 at 02:02:27PM -0400, Jason Merrill wrote: > On 03/18/2014 11:16 AM, Jakub Jelinek wrote: > >Jason, do you have better ideas how to fix this? > > Better would be to return false from potential_constant_expression_1 > for DECL_EXPR; just add another case to the various _STMT tree > codes. Thanks, here is what I've checked in after another bootstrap/regtest: 2014-03-25 Jakub Jelinek <jakub@redhat.com> PR c++/60331 * semantics.c (potential_constant_expression_1): Handle DECL_EXPR. * testsuite/libgomp.c++/udr-11.C: New test. * testsuite/libgomp.c++/udr-12.C: New test. * testsuite/libgomp.c++/udr-13.C: New test. * testsuite/libgomp.c++/udr-14.C: New test. * testsuite/libgomp.c++/udr-15.C: New test. * testsuite/libgomp.c++/udr-16.C: New test. * testsuite/libgomp.c++/udr-17.C: New test. * testsuite/libgomp.c++/udr-18.C: New test. * testsuite/libgomp.c++/udr-19.C: New test. --- gcc/cp/semantics.c.jj 2014-03-13 19:01:19.000000000 +0100 +++ gcc/cp/semantics.c 2014-03-24 20:51:24.912546906 +0100 @@ -10253,6 +10253,7 @@ potential_constant_expression_1 (tree t, case DO_STMT: case FOR_STMT: case WHILE_STMT: + case DECL_EXPR: if (flags & tf_error) error ("expression %qE is not a constant-expression", t); return false; --- libgomp/testsuite/libgomp.c++/udr-11.C.jj 2014-03-18 11:47:43.326846415 +0100 +++ libgomp/testsuite/libgomp.c++/udr-11.C 2014-03-18 11:47:43.329846576 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-1.C" --- libgomp/testsuite/libgomp.c++/udr-12.C.jj 2014-03-18 11:47:43.330846623 +0100 +++ libgomp/testsuite/libgomp.c++/udr-12.C 2014-03-18 11:47:43.331846666 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-2.C" --- libgomp/testsuite/libgomp.c++/udr-13.C.jj 2014-03-18 11:47:43.332846707 +0100 +++ libgomp/testsuite/libgomp.c++/udr-13.C 2014-03-18 11:47:43.332846707 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-3.C" --- libgomp/testsuite/libgomp.c++/udr-14.C.jj 2014-03-18 11:47:43.333846744 +0100 +++ libgomp/testsuite/libgomp.c++/udr-14.C 2014-03-18 11:47:43.334846777 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-4.C" --- libgomp/testsuite/libgomp.c++/udr-15.C.jj 2014-03-18 11:47:43.334846777 +0100 +++ libgomp/testsuite/libgomp.c++/udr-15.C 2014-03-18 11:47:43.335846809 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-5.C" --- libgomp/testsuite/libgomp.c++/udr-16.C.jj 2014-03-18 11:47:43.336846840 +0100 +++ libgomp/testsuite/libgomp.c++/udr-16.C 2014-03-18 11:47:43.336846840 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-6.C" --- libgomp/testsuite/libgomp.c++/udr-17.C.jj 2014-03-18 11:47:43.337846867 +0100 +++ libgomp/testsuite/libgomp.c++/udr-17.C 2014-03-18 11:47:43.337846867 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-7.C" --- libgomp/testsuite/libgomp.c++/udr-18.C.jj 2014-03-18 11:47:43.338846892 +0100 +++ libgomp/testsuite/libgomp.c++/udr-18.C 2014-03-18 11:47:43.338846892 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-8.C" --- libgomp/testsuite/libgomp.c++/udr-19.C.jj 2014-03-18 11:47:43.339846916 +0100 +++ libgomp/testsuite/libgomp.c++/udr-19.C 2014-03-18 11:47:43.339846916 +0100 @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-options "-fopenmp -std=c++11" } + +#include "udr-9.C" Jakub
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads