Commit 64e5ace5 by Thomas Schwinge Committed by Thomas Schwinge

Fix potential ICE (null pointer dereference) in omp-low.c:diagnose_sb_0.

	gcc/
	* omp-low.c (diagnose_sb_0): Make sure label_ctx is valid to
	dereference.
	gcc/testsuite/
	* gcc.dg/cilk-plus/jump-openmp.c: New file.

From-SVN: r207722
parent 7b40f5cf
2014-02-12 Thomas Schwinge <thomas@codesourcery.com>
* omp-low.c (diagnose_sb_0): Make sure label_ctx is valid to
dereference.
2014-02-12 James Greenhalgh <james.greenhalgh@arm.com> 2014-02-12 James Greenhalgh <james.greenhalgh@arm.com>
* config/arm/aarch-cost-tables.h (generic_extra_costs): Fix * config/arm/aarch-cost-tables.h (generic_extra_costs): Fix
......
...@@ -10269,7 +10269,8 @@ diagnose_sb_0 (gimple_stmt_iterator *gsi_p, ...@@ -10269,7 +10269,8 @@ diagnose_sb_0 (gimple_stmt_iterator *gsi_p,
if ((branch_ctx if ((branch_ctx
&& gimple_code (branch_ctx) == GIMPLE_OMP_FOR && gimple_code (branch_ctx) == GIMPLE_OMP_FOR
&& gimple_omp_for_kind (branch_ctx) == GF_OMP_FOR_KIND_CILKSIMD) && gimple_omp_for_kind (branch_ctx) == GF_OMP_FOR_KIND_CILKSIMD)
|| (gimple_code (label_ctx) == GIMPLE_OMP_FOR || (label_ctx
&& gimple_code (label_ctx) == GIMPLE_OMP_FOR
&& gimple_omp_for_kind (label_ctx) == GF_OMP_FOR_KIND_CILKSIMD)) && gimple_omp_for_kind (label_ctx) == GF_OMP_FOR_KIND_CILKSIMD))
cilkplus_block = true; cilkplus_block = true;
} }
......
2014-02-12 Thomas Schwinge <thomas@codesourcery.com>
* gcc.dg/cilk-plus/jump-openmp.c: New file.
2014-02-12 Richard Biener <rguenther@suse.de> 2014-02-12 Richard Biener <rguenther@suse.de>
PR middle-end/60092 PR middle-end/60092
......
/* { dg-do compile } */
/* { dg-options "-fcilkplus -fopenmp" } */
/* { dg-require-effective-target fopenmp } */
int *a, *b, c;
void foo()
{
#pragma simd
for (int i=0; i < 1000; ++i)
{
a[i] = b[i];
if (c == 5)
return; /* { dg-error "invalid branch to/from a Cilk Plus structured block" } */
}
}
void bar()
{
#pragma simd
for (int i=0; i < 1000; ++i)
{
lab:
a[i] = b[i];
}
if (c == 6)
goto lab; /* { dg-error "invalid entry to Cilk Plus structured block" } */
}
void baz()
{
bad1:
#pragma omp parallel
goto bad1; /* { dg-error "invalid branch to/from an OpenMP structured block" } */
goto bad2; /* { dg-error "invalid entry to OpenMP structured block" } */
#pragma omp parallel
{
bad2: ;
}
#pragma omp parallel
{
int i;
goto ok1;
for (i = 0; i < 10; ++i)
{ ok1: break; }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment