diff options
author | Jan Hubicka <jh@suse.cz> | 2009-09-21 14:48:37 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2009-09-21 12:48:37 +0000 |
commit | 5b5fba56fea9bbf4a3406fe32d52925dfe5e2f24 (patch) | |
tree | 458e11e9171ca3215795368326aa21ae7bc1a4be /gcc | |
parent | 9e2ceea07aaab0f8e89f468c9b3766c296d31517 (diff) | |
download | gcc-5b5fba56fea9bbf4a3406fe32d52925dfe5e2f24.zip gcc-5b5fba56fea9bbf4a3406fe32d52925dfe5e2f24.tar.gz gcc-5b5fba56fea9bbf4a3406fe32d52925dfe5e2f24.tar.bz2 |
inline-params.c: New testcase.
* gcc.dg/guality/inline-params.c: New testcase.
* dwarf2out.c (decl_loc_table_eq): Allow decl_loc_table to be NULL.
(dwarf2out_abstract_function): NULLify decl_loc_table at begginig and
restore at the end.
From-SVN: r151917
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/inline-params.c | 41 |
4 files changed, 61 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47c3dfb..83b4fc3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-09-21 Jan Hubicka <jh@suse.cz> + + * dwarf2out.c (decl_loc_table_eq): Allow decl_loc_table to be NULL. + (dwarf2out_abstract_function): NULLify decl_loc_table at begginig and + restore at the end. + 2009-09-21 Eric Botcazou <ebotcazou@adacore.com> * stor-layout.c (layout_type): Remove obsolete code. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 19eabac..a45703e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7491,6 +7491,8 @@ decl_loc_table_eq (const void *x, const void *y) static inline var_loc_list * lookup_decl_loc (const_tree decl) { + if (!decl_loc_table) + return NULL; return (var_loc_list *) htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl)); } @@ -15533,16 +15535,22 @@ dwarf2out_abstract_function (tree decl) tree save_fn; tree context; int was_abstract = DECL_ABSTRACT (decl); + htab_t old_decl_loc_table; /* Make sure we have the actual abstract inline, not a clone. */ decl = DECL_ORIGIN (decl); - htab_empty (decl_loc_table); old_die = lookup_decl_die (decl); if (old_die && get_AT (old_die, DW_AT_inline)) /* We've already generated the abstract instance. */ return; + /* We can be called while recursively when seeing block defining inlined subroutine + DIE. Be sure to not clobber the outer location table nor use it or we would + get locations in abstract instantces. */ + old_decl_loc_table = decl_loc_table; + decl_loc_table = NULL; + /* Be sure we've emitted the in-class declaration DIE (if any) first, so we don't get confused by DECL_ABSTRACT. */ if (debug_info_level > DINFO_LEVEL_TERSE) @@ -15564,6 +15572,7 @@ dwarf2out_abstract_function (tree decl) set_decl_abstract_flags (decl, 0); current_function_decl = save_fn; + decl_loc_table = old_decl_loc_table; pop_cfun (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f51cb86..e676b08 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-09-21 Jan Hubicka <jh@suse.cz> + + * gcc.dg/guality/inline-params.c: New testcase. + 2009-09-21 Uros Bizjak <ubizjak@gmail.com> * gcc.c-torture/execute/ieee/ieee.exp (additional_flags): diff --git a/gcc/testsuite/gcc.dg/guality/inline-params.c b/gcc/testsuite/gcc.dg/guality/inline-params.c new file mode 100644 index 0000000..ff38454 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/inline-params.c @@ -0,0 +1,41 @@ +/* { dg-do run { xfail *-*-* } } */ +/* IPA-SRA removes the argumet as dead, so we don't see their values. */ +/* { dg-options "-g -fno-ipa-sra" } */ +#define GUALITY_DONT_FORCE_LIVE_AFTER -1 + +#ifndef STATIC_INLINE +#define STATIC_INLINE /*static*/ +#endif + + +#include "guality.h" + +struct a{ + struct b {int a;} b; + struct c{ int a;} c; +}; + +__attribute__ ((always_inline)) static inline void +t1 (struct b *ab, int b) +{ + GUALCHKXPRVAL ("b", 0xbbb, 0); + GUALCHKVAL (ab); +} +__attribute__ ((always_inline)) static inline void +t2 (struct c *ac, char *msg) +{ + GUALCHKVAL (ac); + GUALCHKVAL (msg); +} +__attribute__ ((always_inline)) static inline void +t3 (struct a *a) +{ + t1(&a->b, 0xbbb); + t2(&a->c, "test"); +} +struct a a={{0},{1}}; +int +main (int argc, char *argv[]) +{ + t3(&a); +} |