This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR c++/70565] ICE at gimplify.c:8832 (cilkplus array extension)


On Tue, Jan 17, 2017 at 05:43:34AM -0500, Aldy Hernandez wrote:
> The problem at hand can be seen in this simple testcase:
> 
> int array[999];
> void foo()
> {
>   _Cilk_for (int i=0; i < 999; ++i)
>     array[:] = 0;
> }
> 
> The issue here is that the _Cilk_for degrades into an OMP PARALLEL, and we
> fail to expand the array extension in the body of the OMP PARALLEL.
> 
> This is probably an obvious patch, but just in case... OK for trunk?

See comments in PR71473, this is sufficient for this exact case, but
there are lots of other tree codes the C++ expand_array_notation_exprs
doesn't handle.  Consider:
int array[999];
void foo ()
{
  #pragma omp task
  for (int i=0; i < 999; ++i)
    array[:] = 0;
}
and many others.  Also it would be nice to include some testcase
(the above one is weird, you are 999 times clearing the whole array,
and due to the _Cilk_for it is even racy).  Perhaps turn that into
int array[1024];
void foo()
{
  _Cilk_for (int i = 0; i < 512; ++i)
    array[2 * i : 2] = 0;
}
or something similar.

So, if you'd be willing to rewrite the routine into cp_walk_tree with a
callback similarly to how the C FE does this, it would be appreciated.
Otherwise we'll need to keep up endlessly catching up both the current
tree codes that are mishandled as well as any future tree codes.

> commit d92a180d74fc6b20f140928eadccc406fba25edc
> Author: Aldy Hernandez <aldyh@redhat.com>
> Date:   Mon Jan 16 11:28:35 2017 -0500
> 
>             PR c++/70565
>             * cp/cp-array-notation.c (expand_array_notation_exprs): Handle
>             OMP_PARALLEL.

No cp/ prefix in cp/ChangeLog.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]