From: Richard Biener Date: Fri, 27 Feb 2015 11:34:14 +0000 (+0000) Subject: re PR tree-optimization/65193 (ICE: Segmentation fault with -g -flto) X-Git-Tag: releases/gcc-4.8.5~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0186dd470abf457e1a86fe41fae2512aeb34a960;p=thirdparty%2Fgcc.git re PR tree-optimization/65193 (ICE: Segmentation fault with -g -flto) 2015-02-27 Richard Biener PR lto/65193 Backport from mainline 2014-07-24 Jan Hubicka * lto-streamer-out.c (tree_is_indexable): Consider IMPORTED_DECL as non-indexable. * g++.dg/lto/pr65193_0.C: New testcase. From-SVN: r221054 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d42bc827c97d..dce2ea05ae7b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-02-27 Richard Biener + + PR lto/65193 + Backport from mainline + 2014-07-24 Jan Hubicka + + * lto-streamer-out.c (tree_is_indexable): Consider IMPORTED_DECL + as non-indexable. + 2015-02-26 Peter Bergner Backport from mainline diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index b205092f597b..c898c23d6f66 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -129,6 +129,9 @@ tree_is_indexable (tree t) else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t) && !TREE_STATIC (t)) return false; + /* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */ + else if (TREE_CODE (t) == IMPORTED_DECL) + return false; /* Variably modified types need to be streamed alongside function bodies because they can refer to local entities. Together with them we have to localize their members as well. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b29c10d6fce..10317c10a3ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-27 Richard Biener + + PR lto/65193 + * g++.dg/lto/pr65193_0.C: New testcase. + 2015-02-26 Peter Bergner Backport from mainline diff --git a/gcc/testsuite/g++.dg/lto/pr65193_0.C b/gcc/testsuite/g++.dg/lto/pr65193_0.C new file mode 100644 index 000000000000..d778fcabb7fc --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr65193_0.C @@ -0,0 +1,71 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target fpic } */ +/* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g}} } */ + +void frexp (int, int *); +namespace std +{ + int ldexp (int, int); + struct A + { + }; + template T get_min_shift_value (); + template struct min_shift_initializer + { + struct B + { + B () { get_min_shift_value (); } + } static const b; + static void + m_fn1 () + { + b; + } + }; + template + const typename min_shift_initializer::B min_shift_initializer::b; + template + inline T + get_min_shift_value () + { + using std::ldexp; + static T c = ldexp (0, 0); + min_shift_initializer::m_fn1; + } + template + void + float_next_imp (T p1, Policy p2) + { + using std::ldexp; + int d; + float_next (0, p2); + frexp (p1, &d); + } + template + int + float_next (const T &p1, Policy &p2) + { + float_next_imp (p1, p2); + } + template void float_prior_imp (T, Policy) + { + get_min_shift_value (); + } + template int float_prior (T, Policy) + { + float_prior_imp (static_cast (0), 0); + } + template + void + nextafter (T p1, U p2, Policy p3) + { + p2 ? float_next (0, p3) : float_prior (p1, 0); + } + long double e; + int f; + void + nextafter () + { + nextafter (e, f, A ()); + } +}