public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 59628
@ 2014-12-12 21:13 Paolo Carlini
  2014-12-12 21:17 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2014-12-12 21:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

Hi,

I think that to avoid ICE-ing during error recovery when DECL_SAVED_TREE 
is NULL_TREE we want to simply bail out and return true to the caller. 
Tested x86_64-linux.

Thanks,
Paolo.

//////////////////

[-- Attachment #2: CL_59628 --]
[-- Type: text/plain, Size: 288 bytes --]

/cp
2014-12-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59628
	* semantics.c (finish_omp_reduction_clause): Early return true
	if DECL_SAVED_TREE (id) is NULL_TREE.

/testsuite
2014-12-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59628
	* g++.dg/gomp/pr59628.C: New.

[-- Attachment #3: patch_59628 --]
[-- Type: text/plain, Size: 922 bytes --]

Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 218683)
+++ cp/semantics.c	(working copy)
@@ -5138,6 +5138,8 @@ finish_omp_reduction_clause (tree c, bool *need_de
       id = OVL_CURRENT (id);
       mark_used (id);
       tree body = DECL_SAVED_TREE (id);
+      if (!body)
+	return true;
       if (TREE_CODE (body) == STATEMENT_LIST)
 	{
 	  tree_stmt_iterator tsi;
Index: testsuite/g++.dg/gomp/pr59628.C
===================================================================
--- testsuite/g++.dg/gomp/pr59628.C	(revision 0)
+++ testsuite/g++.dg/gomp/pr59628.C	(working copy)
@@ -0,0 +1,13 @@
+// PR c++/59628
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A { int i; };
+
+void foo()
+{
+  A a;
+  #pragma omp declare reduction (+: A: omp_out.i +: omp_in.i)  // { dg-error "expected" }
+  #pragma omp parallel reduction (+: a)
+  ;
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 59628
  2014-12-12 21:13 [C++ Patch] PR 59628 Paolo Carlini
@ 2014-12-12 21:17 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2014-12-12 21:17 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches, Jason Merrill

On Fri, Dec 12, 2014 at 10:13:39PM +0100, Paolo Carlini wrote:
> Hi,
> 
> I think that to avoid ICE-ing during error recovery when DECL_SAVED_TREE is
> NULL_TREE we want to simply bail out and return true to the caller. Tested
> x86_64-linux.
> 
> Thanks,
> Paolo.
> 
> //////////////////

> /cp
> 2014-12-12  Paolo Carlini  <paolo.carlini@oracle.com>
> 
> 	PR c++/59628
> 	* semantics.c (finish_omp_reduction_clause): Early return true
> 	if DECL_SAVED_TREE (id) is NULL_TREE.
> 
> /testsuite
> 2014-12-12  Paolo Carlini  <paolo.carlini@oracle.com>
> 
> 	PR c++/59628
> 	* g++.dg/gomp/pr59628.C: New.

Ok, thanks.

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-12 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-12 21:13 [C++ Patch] PR 59628 Paolo Carlini
2014-12-12 21:17 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).