re PR tree-optimization/41841 (segfault using '-O -fipa-cp -fipa-struct-reorg -fwhole-program -fprofile-generate')

PR tree-optimization/41841
	* ipa-struct-reorg.c (build_data_structure): Don't attempt to look at
	local variables of not yet materialized clones.

	* gcc.dg/pr41841.c: New test.

From-SVN: r153807
This commit is contained in:
Jakub Jelinek 2009-11-02 14:57:13 +01:00 committed by Jakub Jelinek
parent 0fba566cb5
commit 68052d59d6
4 changed files with 37 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2009-11-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/41841
* ipa-struct-reorg.c (build_data_structure): Don't attempt to look at
local variables of not yet materialized clones.
PR debug/41893
* cfgexpand.c (expand_debug_expr): Don't attempt to create DECL_RTL
for a VOIDmode variable.

View File

@ -3380,6 +3380,14 @@ build_data_structure (VEC (tree, heap) **unsuitable_types)
if (is_candidate (var, &type, unsuitable_types))
add_structure (type);
if (fn == NULL)
{
/* Skip cones that haven't been materialized yet. */
gcc_assert (c_node->clone_of
&& c_node->clone_of->decl != c_node->decl);
continue;
}
/* Check function local variables. */
for (var_list = fn->local_decls; var_list;
var_list = TREE_CHAIN (var_list))

View File

@ -1,5 +1,8 @@
2009-11-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/41841
* gcc.dg/pr41841.c: New test.
PR debug/41893
* gcc.dg/debug/pr41893-1.c: New test.
* gcc.dg/debug/pr41893-2.c: New file.

View File

@ -0,0 +1,22 @@
/* PR tree-optimization/41841 */
/* { dg-do compile } */
/* { dg-options "-O -fipa-struct-reorg -fwhole-program -fipa-cp" } */
typedef struct S *T;
typedef struct { } *U;
extern int f1 (void);
static void
f3 (U x, int y)
{
T a = (T) x;
y && f1 ();
}
static void
f2 (T x)
{
f3 ((U) x, 1);
}
void *volatile a __attribute__((used)) = f2;