From 423ed4163b160e8fa81758ed53e54c60040f3c0f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 3 Mar 2011 17:09:55 +0100 Subject: [PATCH] re PR c/47963 (ICE: tree check: expected tree that contains 'decl common' structure, have 'integer_cst' in is_global_var, at tree-flow-inline.h:599 on invalid code with -fopenmp) PR c/47963 * gimplify.c (omp_add_variable): Only call omp_notice_variable on TYPE_SIZE_UNIT if it is a DECL. * gcc.dg/gomp/pr47963.c: New test. * g++.dg/gomp/pr47963.C: New test. From-SVN: r170655 --- gcc/ChangeLog | 4 ++++ gcc/gimplify.c | 5 +++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/gomp/pr47963.C | 11 +++++++++++ gcc/testsuite/gcc.dg/gomp/pr47963.c | 11 +++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr47963.C create mode 100644 gcc/testsuite/gcc.dg/gomp/pr47963.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d524d50f9a..1273286301b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-03-03 Jakub Jelinek + PR c/47963 + * gimplify.c (omp_add_variable): Only call omp_notice_variable + on TYPE_SIZE_UNIT if it is a DECL. + PR debug/47283 * cfgexpand.c (expand_debug_expr) : If MEM_REF first operand is not is_gimple_mem_ref_addr, try to fold it. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 350d793b747..cf9495c9198 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1,6 +1,6 @@ /* Tree lowering pass. This pass converts the GENERIC functions-as-trees tree representation into the GIMPLE form. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Major work done by Sebastian Pop , Diego Novillo and Jason Merrill . @@ -5511,7 +5511,8 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) For local variables TYPE_SIZE_UNIT might not be gimplified yet, in this case omp_notice_variable will be called later on when it is gimplified. */ - else if (! (flags & GOVD_LOCAL)) + else if (! (flags & GOVD_LOCAL) + && DECL_P (TYPE_SIZE_UNIT (TREE_TYPE (decl)))) omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true); } else if (lang_hooks.decls.omp_privatize_by_reference (decl)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7b139222f3a..3f7a372fa0a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-03-03 Jakub Jelinek + + PR c/47963 + * gcc.dg/gomp/pr47963.c: New test. + * g++.dg/gomp/pr47963.C: New test. + 2011-03-02 Jason Merrill * g++.dg/cpp0x/regress/condition1.C: New. diff --git a/gcc/testsuite/g++.dg/gomp/pr47963.C b/gcc/testsuite/g++.dg/gomp/pr47963.C new file mode 100644 index 00000000000..7c94e6422a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr47963.C @@ -0,0 +1,11 @@ +// PR c/47963 +// { dg-do compile } +// { dg-options "-fopenmp" } + +void +foo (float n) +{ + int A[n][n]; // { dg-error "has non-integral type" } +#pragma omp parallel private(A) + ; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr47963.c b/gcc/testsuite/gcc.dg/gomp/pr47963.c new file mode 100644 index 00000000000..636a9542c32 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr47963.c @@ -0,0 +1,11 @@ +/* PR c/47963 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (float n) +{ + int A[n][n]; /* { dg-error "has non-integer type" } */ +#pragma omp parallel private(A) + ; +} -- 2.30.2