re PR tree-optimization/51865 (ICE in insert_vi_for_tree, at tree-ssa-structalias.c:2642)

PR tree-optimization/51865
	* tree-inline.c (tree_function_versioning): Call remap_decl
	on DECL_RESULT whenever it has VOID_TYPE_P type.

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

From-SVN: r183207
This commit is contained in:
Jakub Jelinek 2012-01-16 12:12:53 +01:00 committed by Jakub Jelinek
parent 12e3ff92d4
commit 90dda0e956
4 changed files with 40 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2012-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/51865
* tree-inline.c (tree_function_versioning): Call remap_decl
on DECL_RESULT whenever it has VOID_TYPE_P type.
2012-01-15 Richard Sandiford <rdsandiford@googlemail.com> 2012-01-15 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.c (mips16_build_call_stub): Don't use a stub * config/mips/mips.c (mips16_build_call_stub): Don't use a stub

View File

@ -1,3 +1,8 @@
2012-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/51865
* gcc.dg/pr51865.c: New test.
2012-01-15 Richard Sandiford <rdsandiford@googlemail.com> 2012-01-15 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Expect 4 threaded edges for MIPS. * gcc.dg/tree-ssa/ssa-dom-thread-4.c: Expect 4 threaded edges for MIPS.

View File

@ -0,0 +1,25 @@
/* PR tree-optimization/51865 */
/* { dg-do compile } */
/* { dg-options "-O2 -fipa-pta" } */
void fn (const char *, const char *) __attribute__ ((__noreturn__));
int var;
inline void
foo (void)
{
if (__builtin_expect (var != 0, 0))
fn ("a", "b");
};
void
bar (void)
{
foo ();
};
void
baz (void)
{
foo ();
};

View File

@ -1,6 +1,6 @@
/* Tree inlining. /* Tree inlining.
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Free Software Foundation, Inc. 2012 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com> Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GCC. This file is part of GCC.
@ -5201,9 +5201,9 @@ tree_function_versioning (tree old_decl, tree new_decl,
/* Add local vars. */ /* Add local vars. */
add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false); add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false);
if (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl)))) if (DECL_RESULT (old_decl) == NULL_TREE)
; ;
else if (skip_return) else if (skip_return && !VOID_TYPE_P (TREE_TYPE (DECL_RESULT (old_decl))))
{ {
DECL_RESULT (new_decl) DECL_RESULT (new_decl)
= build_decl (DECL_SOURCE_LOCATION (DECL_RESULT (old_decl)), = build_decl (DECL_SOURCE_LOCATION (DECL_RESULT (old_decl)),