From e0ffb247d696aa7a98088e0cd9c647947b1d5d39 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 13 Jan 2015 13:57:27 +0000 Subject: [PATCH] re PR lto/64373 (ICE with lto related to variably modified type) 2015-01-13 Richard Biener PR lto/64373 * lto-streamer-out.c (tree_is_indexable): Guard for NULL DECL_CONTEXT. * gcc.dg/lto/pr64373_0.c: New testcase. From-SVN: r219531 --- gcc/ChangeLog | 6 ++++++ gcc/lto-streamer-out.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/lto/pr64373_0.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr64373_0.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b1449b3f21..6bf509eb131 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-13 Richard Biener + + PR lto/64373 + * lto-streamer-out.c (tree_is_indexable): Guard for NULL + DECL_CONTEXT. + 2015-01-13 Andrew Pinski * config/aarch64/aarch64.c (aarch64_operands_ok_for_ldpstp): Reject diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 21a78bb77aa..3b581918d6a 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -154,7 +154,8 @@ tree_is_indexable (tree t) /* Parameters and return values of functions of variably modified types must go to global stream, because they may be used in the type definition. */ - if (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) + if ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) + && DECL_CONTEXT (t)) return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE); /* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */ else if (TREE_CODE (t) == IMPORTED_DECL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a5a62e2f88..a3fea9be37f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Richard Biener + + PR lto/64373 + * gcc.dg/lto/pr64373_0.c: New testcase. + 2015-01-13 Andrew Pinski * gcc.target/aarch64/volatileloadpair-1.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/lto/pr64373_0.c b/gcc/testsuite/gcc.dg/lto/pr64373_0.c new file mode 100644 index 00000000000..b4f3fdf1863 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64373_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do assemble } */ + +extern void b(int L, float (*data)[L]); + +void a(void) +{ + float* p = 0; + int i = 0; + b(10, (float (*)[10])(p + i)); +} -- 2.30.2