public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
@ 2016-01-14 21:19 Ryan Burn
  2016-01-14 21:57 ` Jeff Law
  0 siblings, 1 reply; 8+ messages in thread
From: Ryan Burn @ 2016-01-14 21:19 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill, Jeff Law; +Cc: igor.zamyatin

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

This patch adds a missing cleanup point to cilk_spawn expressions to
prevent an ICE when calling functions that return types with
non-trivial destructors.

Bootstrapped and regression tested on x86_64-linux.

2015-01-14 Ryan Burn  <contact@rnburn.com>

     PR c++/69048
       * cilk.c (create_cilk_wrapper_body): Call
fold_build_cleanup_point_expr to add missing cleanup point.

       * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test

[-- Attachment #2: pr69048.diff --]
[-- Type: text/plain, Size: 1131 bytes --]

Index: gcc/c-family/cilk.c
===================================================================
--- gcc/c-family/cilk.c	(revision 232359)
+++ gcc/c-family/cilk.c	(working copy)
@@ -592,6 +592,11 @@
   for (p = wd->parms; p; p = TREE_CHAIN (p))
     DECL_CONTEXT (p) = fndecl;
 
+  /* The statement containing the spawn expression might create temporaries with
+     destructors defined; if so we need to add a CLEANUP_POINT_EXPR to ensure
+     the expression is properly gimplified.  */
+  stmt = fold_build_cleanup_point_expr (void_type_node, stmt);
+
   gcc_assert (!DECL_SAVED_TREE (fndecl));
   cilk_install_body_with_frame_cleanup (fndecl, stmt, (void *) wd);
   gcc_assert (DECL_SAVED_TREE (fndecl));
Index: gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc
===================================================================
--- gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc	(revision 0)
+++ gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc	(working copy)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+struct A {
+  ~A () {}
+};
+
+A f () {
+  return A ();
+}
+
+void t1 () {
+  _Cilk_spawn f ();
+}

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 21:19 [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048) Ryan Burn
@ 2016-01-14 21:57 ` Jeff Law
  2016-01-14 22:15   ` Ryan Burn
  2016-01-14 22:34   ` Jakub Jelinek
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Law @ 2016-01-14 21:57 UTC (permalink / raw)
  To: Ryan Burn, gcc-patches, Jason Merrill; +Cc: igor.zamyatin

On 01/14/2016 02:19 PM, Ryan Burn wrote:
> This patch adds a missing cleanup point to cilk_spawn expressions to
> prevent an ICE when calling functions that return types with
> non-trivial destructors.
>
> Bootstrapped and regression tested on x86_64-linux.
>
> 2015-01-14 Ryan Burn  <contact@rnburn.com>
>
>       PR c++/69048
>         * cilk.c (create_cilk_wrapper_body): Call
> fold_build_cleanup_point_expr to add missing cleanup point.
>
>         * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test
I thought something was horribly wrong for a few minutes.  STMT inside 
cilk_create_wrapper_body is a tree, not a gimple statement.  So my 
worries were unfounded :-)

OK for the trunk.
jeff

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 21:57 ` Jeff Law
@ 2016-01-14 22:15   ` Ryan Burn
  2016-01-14 22:16     ` Jeff Law
  2016-01-14 22:34   ` Jakub Jelinek
  1 sibling, 1 reply; 8+ messages in thread
From: Ryan Burn @ 2016-01-14 22:15 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Jason Merrill, igor.zamyatin

Could you push please? I don't have write access. Thanks - Ryan.

On Thu, Jan 14, 2016 at 4:57 PM, Jeff Law <law@redhat.com> wrote:
> On 01/14/2016 02:19 PM, Ryan Burn wrote:
>>
>> This patch adds a missing cleanup point to cilk_spawn expressions to
>> prevent an ICE when calling functions that return types with
>> non-trivial destructors.
>>
>> Bootstrapped and regression tested on x86_64-linux.
>>
>> 2015-01-14 Ryan Burn  <contact@rnburn.com>
>>
>>       PR c++/69048
>>         * cilk.c (create_cilk_wrapper_body): Call
>> fold_build_cleanup_point_expr to add missing cleanup point.
>>
>>         * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test
>
> I thought something was horribly wrong for a few minutes.  STMT inside
> cilk_create_wrapper_body is a tree, not a gimple statement.  So my worries
> were unfounded :-)
>
> OK for the trunk.
> jeff

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 22:15   ` Ryan Burn
@ 2016-01-14 22:16     ` Jeff Law
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Law @ 2016-01-14 22:16 UTC (permalink / raw)
  To: Ryan Burn; +Cc: gcc-patches, Jason Merrill, igor.zamyatin

On 01/14/2016 03:14 PM, Ryan Burn wrote:
> Could you push please? I don't have write access. Thanks - Ryan.
Will do.

Do you *want* write access?  It's pretty easy to set up.

jeff

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 21:57 ` Jeff Law
  2016-01-14 22:15   ` Ryan Burn
@ 2016-01-14 22:34   ` Jakub Jelinek
  2016-01-14 22:41     ` Ryan Burn
  2016-01-14 22:47     ` Jeff Law
  1 sibling, 2 replies; 8+ messages in thread
From: Jakub Jelinek @ 2016-01-14 22:34 UTC (permalink / raw)
  To: Jeff Law; +Cc: Ryan Burn, gcc-patches, Jason Merrill, igor.zamyatin

On Thu, Jan 14, 2016 at 02:57:06PM -0700, Jeff Law wrote:
> On 01/14/2016 02:19 PM, Ryan Burn wrote:
> >This patch adds a missing cleanup point to cilk_spawn expressions to
> >prevent an ICE when calling functions that return types with
> >non-trivial destructors.
> >
> >Bootstrapped and regression tested on x86_64-linux.
> >
> >2015-01-14 Ryan Burn  <contact@rnburn.com>
> >
> >      PR c++/69048
> >        * cilk.c (create_cilk_wrapper_body): Call
> >fold_build_cleanup_point_expr to add missing cleanup point.
> >
> >        * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test
> I thought something was horribly wrong for a few minutes.  STMT inside
> cilk_create_wrapper_body is a tree, not a gimple statement.  So my worries
> were unfounded :-)
> 
> OK for the trunk.

Note the ChangeLog entry is badly formatted (unless the MUA broke it).  There
should be two spaces in between date and name instead of one, and the PR
line as well as all the other lines of entries should be tab indented,
and each description should end with full stop, and gcc/testsuite/ has its
own ChangeLog, so that part should go into that ChangeLog file and be
without prefix.

2015-01-14  Ryan Burn  <contact@rnburn.com>

	PR c++/69048
	* cilk.c (create_cilk_wrapper_body): Call
	fold_build_cleanup_point_expr to add missing cleanup point.

	* g++.dg/cilk-plus/CK/pr69048.cc: New test.

The
  /* The statement containing the spawn expression might create temporaries with
line is (1 char) too long, so you want to reformat that comment.

	Jakub

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 22:34   ` Jakub Jelinek
@ 2016-01-14 22:41     ` Ryan Burn
  2016-01-14 22:53       ` Jakub Jelinek
  2016-01-14 22:47     ` Jeff Law
  1 sibling, 1 reply; 8+ messages in thread
From: Ryan Burn @ 2016-01-14 22:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jeff Law, gcc-patches, Jason Merrill, igor.zamyatin

On Thu, Jan 14, 2016 at 5:34 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jan 14, 2016 at 02:57:06PM -0700, Jeff Law wrote:
>> On 01/14/2016 02:19 PM, Ryan Burn wrote:
>> >This patch adds a missing cleanup point to cilk_spawn expressions to
>> >prevent an ICE when calling functions that return types with
>> >non-trivial destructors.
>> >
>> >Bootstrapped and regression tested on x86_64-linux.
>> >
>> >2015-01-14 Ryan Burn  <contact@rnburn.com>
>> >
>> >      PR c++/69048
>> >        * cilk.c (create_cilk_wrapper_body): Call
>> >fold_build_cleanup_point_expr to add missing cleanup point.
>> >
>> >        * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test
>> I thought something was horribly wrong for a few minutes.  STMT inside
>> cilk_create_wrapper_body is a tree, not a gimple statement.  So my worries
>> were unfounded :-)
>>
>> OK for the trunk.
>
> Note the ChangeLog entry is badly formatted (unless the MUA broke it).  There
> should be two spaces in between date and name instead of one, and the PR
> line as well as all the other lines of entries should be tab indented,
> and each description should end with full stop, and gcc/testsuite/ has its
> own ChangeLog, so that part should go into that ChangeLog file and be
> without prefix.
>
> 2015-01-14  Ryan Burn  <contact@rnburn.com>
>
>         PR c++/69048
>         * cilk.c (create_cilk_wrapper_body): Call
>         fold_build_cleanup_point_expr to add missing cleanup point.
>
>         * g++.dg/cilk-plus/CK/pr69048.cc: New test.
>
> The
>   /* The statement containing the spawn expression might create temporaries with
> line is (1 char) too long, so you want to reformat that comment.
>
>         Jakub

Are you sure? It passed the check_GNU_style.sh script. If you exclude
the extra + added in the diff, it's within 80 characters.

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 22:34   ` Jakub Jelinek
  2016-01-14 22:41     ` Ryan Burn
@ 2016-01-14 22:47     ` Jeff Law
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2016-01-14 22:47 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ryan Burn, gcc-patches, Jason Merrill, igor.zamyatin

On 01/14/2016 03:34 PM, Jakub Jelinek wrote:
> On Thu, Jan 14, 2016 at 02:57:06PM -0700, Jeff Law wrote:
>> On 01/14/2016 02:19 PM, Ryan Burn wrote:
>>> This patch adds a missing cleanup point to cilk_spawn expressions to
>>> prevent an ICE when calling functions that return types with
>>> non-trivial destructors.
>>>
>>> Bootstrapped and regression tested on x86_64-linux.
>>>
>>> 2015-01-14 Ryan Burn  <contact@rnburn.com>
>>>
>>>       PR c++/69048
>>>         * cilk.c (create_cilk_wrapper_body): Call
>>> fold_build_cleanup_point_expr to add missing cleanup point.
>>>
>>>         * gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc: New test
>> I thought something was horribly wrong for a few minutes.  STMT inside
>> cilk_create_wrapper_body is a tree, not a gimple statement.  So my worries
>> were unfounded :-)
>>
>> OK for the trunk.
>
> Note the ChangeLog entry is badly formatted (unless the MUA broke it).  There
> should be two spaces in between date and name instead of one, and the PR
> line as well as all the other lines of entries should be tab indented,
> and each description should end with full stop, and gcc/testsuite/ has its
> own ChangeLog, so that part should go into that ChangeLog file and be
> without prefix.
I had actually fixed most of the ChangeLog nits before pushing.  I 
missed the two space thingie :(


>
> 2015-01-14  Ryan Burn  <contact@rnburn.com>
>
> 	PR c++/69048
> 	* cilk.c (create_cilk_wrapper_body): Call
> 	fold_build_cleanup_point_expr to add missing cleanup point.
>
> 	* g++.dg/cilk-plus/CK/pr69048.cc: New test.
>
> The
>    /* The statement containing the spawn expression might create temporaries with
> line is (1 char) too long, so you want to reformat that comment.
It ends right at 80 columns.  Arguably we should have everything ending 
at 79.

Jeff

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

* Re: [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
  2016-01-14 22:41     ` Ryan Burn
@ 2016-01-14 22:53       ` Jakub Jelinek
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Jelinek @ 2016-01-14 22:53 UTC (permalink / raw)
  To: Ryan Burn; +Cc: Jeff Law, gcc-patches, Jason Merrill, igor.zamyatin

On Thu, Jan 14, 2016 at 05:41:25PM -0500, Ryan Burn wrote:
> > The
> >   /* The statement containing the spawn expression might create temporaries with
> > line is (1 char) too long, so you want to reformat that comment.
> >
> >         Jakub
> 
> Are you sure? It passed the check_GNU_style.sh script. If you exclude
> the extra + added in the diff, it's within 80 characters.

You're right, sorry.
echo -n '  /* The statement containing the spawn expression might create temporaries with' | wc -c
80

	Jakub

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

end of thread, other threads:[~2016-01-14 22:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-14 21:19 [cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048) Ryan Burn
2016-01-14 21:57 ` Jeff Law
2016-01-14 22:15   ` Ryan Burn
2016-01-14 22:16     ` Jeff Law
2016-01-14 22:34   ` Jakub Jelinek
2016-01-14 22:41     ` Ryan Burn
2016-01-14 22:53       ` Jakub Jelinek
2016-01-14 22:47     ` Jeff Law

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).