re PR lto/48437 (LTO crashes with block-local function declarations)

2011-12-08  Richard Guenther  <rguenther@suse.de>

	PR lto/48437
	* lto-streamer-out.c (tree_is_indexable): Exclude block-local
	extern declarations.

	* gcc.dg/lto/20111207-2_0.c: New testcase.
	* gcc.dg/guality/pr48437.c: Likewise.

From-SVN: r182100
This commit is contained in:
Richard Guenther 2011-12-08 08:50:35 +00:00 committed by Richard Biener
parent a633b93ea3
commit c37257a1f6
5 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2011-12-08 Richard Guenther <rguenther@suse.de>
PR lto/48437
* lto-streamer-out.c (tree_is_indexable): Exclude block-local
extern declarations.
2011-12-07 Andrew Pinski <apinski@cavium.com>
PR middle-end/45416

View File

@ -129,6 +129,16 @@ tree_is_indexable (tree t)
else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t)
&& !TREE_STATIC (t))
return false;
/* If this is a decl generated for block local externs for
debug info generation, stream it unshared alongside BLOCK_VARS. */
else if (VAR_OR_FUNCTION_DECL_P (t)
/* ??? The following tests are a literal match on what
c-decl.c:pop_scope does. */
&& TREE_PUBLIC (t)
&& DECL_EXTERNAL (t)
&& DECL_CONTEXT (t)
&& TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL)
return false;
else
return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME);
}

View File

@ -1,3 +1,9 @@
2011-12-08 Richard Guenther <rguenther@suse.de>
PR lto/48437
* gcc.dg/lto/20111207-2_0.c: New testcase.
* gcc.dg/guality/pr48437.c: Likewise.
2011-12-07 Jakub Jelinek <jakub@redhat.com>
PR c++/51401

View File

@ -0,0 +1,17 @@
/* PR lto/48437 */
/* { dg-do run } */
/* { dg-options "-g" } */
#include "../nop.h"
int i __attribute__((used));
int main()
{
volatile int i;
for (i = 3; i < 7; ++i)
{
extern int i;
asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test 14 "i" "0" } } */
}
return 0;
}

View File

@ -0,0 +1,17 @@
/* { dg-lto-do run } */
int
test (void)
{
int f (void);
return 0;
}
int
main (void)
{
int f (void);
int test (void);
return test ();
}