diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-09-17 22:31:54 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-09-17 22:31:54 +0200 |
commit | 591a849566e65174724a0e63f16eefb0538904f8 (patch) | |
tree | 2224826c9b77234cf421aa40304993b6bf2a8f51 /gcc | |
parent | 417b30235b1bd5a8af13a21741f7845d4dff3029 (diff) | |
download | gcc-591a849566e65174724a0e63f16eefb0538904f8.zip gcc-591a849566e65174724a0e63f16eefb0538904f8.tar.gz gcc-591a849566e65174724a0e63f16eefb0538904f8.tar.bz2 |
c-decl.c (finish_struct): Adjust DECL_SOURCE_LOCATION of TYPE_STUB_DECL.
* c-decl.c (finish_struct): Adjust DECL_SOURCE_LOCATION of
TYPE_STUB_DECL.
* gcc.dg/debug/dwarf2/struct-loc1.c: New test.
From-SVN: r151816
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-decl.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c | 17 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 590c809..70495b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-09-17 Jakub Jelinek <jakub@redhat.com> + + * c-decl.c (finish_struct): Adjust DECL_SOURCE_LOCATION of + TYPE_STUB_DECL. + 2009-09-17 Alexandre Oliva <aoliva@redhat.com> * dwarf2out.c (loc_descriptor): Emit DW_OP_stack_value and diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ed8863d..c44e35c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6859,6 +6859,11 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, } C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0; + /* Update type location to the one of the definition, instead of e.g. + a forward declaration. */ + if (TYPE_STUB_DECL (t)) + DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc; + /* Finish debugging output for this type. */ rest_of_type_compilation (t, toplevel); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c627014..e4b5853 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-09-17 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/debug/dwarf2/struct-loc1.c: New test. + 2009-09-17 Janis Johnson <janis187@us.ibm.com> PR c/41049 diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c new file mode 100644 index 0000000..216a498 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/struct-loc1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-g -O0 -dA -fno-merge-debug-strings" } */ + +struct foo; +struct foo *obj; +struct foo +{ + int x; +}; + +int +main () +{ + return 0; +} + +/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"foo\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?6\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */ |