diff mbox

[gomp4,PR68977,Committed] Don't gimplify in ssa mode if seen_error in oacc_xform_loop

Message ID 5696ADD7.5040202@mentor.com
State New
Headers show

Commit Message

Tom de Vries Jan. 13, 2016, 8:04 p.m. UTC
Hi,

At r231739, there was an ICE when checking code generated by 
oacc_xform_loop, in case the source contained an error.

Due to seen_error (), gimplification during oacc_xform_loop bailed out, 
and an uninitialized var was introduced.  Because of gimplifying in ssa 
mode, that caused an ICE.

I can't reproduce this any longer, but I think the fix still makes 
sense. The patch makes sure oacc_xform_loop gimplifies in non-ssa mode 
if seen_error ().

Build on x86_64 with nvidia accelerator setup, tested libgomp and goacc.exp.

Committed to gomp-4_0-branch.

Thanks,
- Tom

Comments

Richard Biener Jan. 14, 2016, 9:43 a.m. UTC | #1
On Wed, Jan 13, 2016 at 9:04 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> Hi,
>
> At r231739, there was an ICE when checking code generated by
> oacc_xform_loop, in case the source contained an error.
>
> Due to seen_error (), gimplification during oacc_xform_loop bailed out, and
> an uninitialized var was introduced.  Because of gimplifying in ssa mode,
> that caused an ICE.
>
> I can't reproduce this any longer, but I think the fix still makes sense.
> The patch makes sure oacc_xform_loop gimplifies in non-ssa mode if
> seen_error ().

I don't think it makes "sense" in any way.  After seen_error () a following ICE
will be "confused after earlier errors" in release mode and thus I think that's
not an important problem to paper over with this kind of "hack".

I'd rather avoid doing any of omp-low if seen_error ()?

Richard.

> Build on x86_64 with nvidia accelerator setup, tested libgomp and goacc.exp.
>
> Committed to gomp-4_0-branch.
>
> Thanks,
> - Tom
diff mbox

Patch

Don't gimplify in ssa mode if seen_error in oacc_xform_loop

2016-01-13  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/68977
	* omp-low.c (oacc_xform_loop): Handle seen_error () == true.
---
 gcc/ChangeLog.gomp | 5 +++++
 gcc/omp-low.c      | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c99f0b8..a6e3fe3 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -19105,7 +19105,12 @@  oacc_xform_loop (gcall *call)
        -> chunks=ceil (range/(chunksize*threads*step))
      striding=false,chunking=false
        -> chunk_size=ceil(range/(threads*step)),chunks=1  */
-  push_gimplify_context (true);
+
+  /* If seen_error (), we may introduce an uninitialized var due to
+     gimplification bailing out.  If we gimplify in ssa mode, that will cause an
+     ICE.  If we gimplify in non-ssa mode, then ssa updating will turn it into a
+     default definition, and we avoid the ICE.  */
+  push_gimplify_context (!seen_error ());
 
   switch (code)
     {