[Bug debug/91507] wrong debug for completed array with previous incomplete declaration
aoliva at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 1 11:37:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91507
--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Tue Oct 1 11:36:31 2019
New Revision: 276403
URL: https://gcc.gnu.org/viewcvs?rev=276403&root=gcc&view=rev
Log:
DWARF array bounds missing from C++ array definitions
A variable redeclaration or definition that provides additional type
information for it, e.g. outermost array bounds, is not reflected in
the debug information for the variable. With this patch, the debug
info of the variable specialization gets a type attribute with the
adjusted type.
This patch affects mostly only array bounds. However, when the
symbolic type used in a declaration and in a definition are different,
although they refer to the same type, debug information will end up
(correctly?) naming different symbolic types in the specification and
the definition. Also, when a readonly declaration of an array loses
the readonly flag at the definition because of the initializer, the
definition may end up referencing a type while the specification
refers to a const-qualified version of that type. If the type of the
variable is already const-qualified, e.g. an array of a const type,
the difference is meaningless.
for gcc/ChangeLog
PR debug/91507
* dwarf2out.c (override_type_for_decl_p): New.
(gen_variable_die): Use it.
for gcc/testsuite/ChangeLog
PR debug/91507
* gcc.dg/debug/dwarf2/array-0.c: New.
* gcc.dg/debug/dwarf2/array-1.c: New.
* gcc.dg/debug/dwarf2/array-2.c: New.
* gcc.dg/debug/dwarf2/array-3.c: New.
* g++.dg/debug/dwarf2/array-0.C: New.
* g++.dg/debug/dwarf2/array-1.C: New.
* g++.dg/debug/dwarf2/array-2.C: New. Based on libstdc++-v3's
src/c++98/pool_allocator.cc:__pool_alloc_base::_S_heap_size.
* g++.dg/debug/dwarf2/array-3.C: New. Based on
gcc's config/i386/i386-features.c:xlogue_layout::s_instances.
* g++.dg/debug/dwarf2/array-4.C: New.
Added:
trunk/gcc/testsuite/g++.dg/debug/dwarf2/array-0.C
trunk/gcc/testsuite/g++.dg/debug/dwarf2/array-1.C
trunk/gcc/testsuite/g++.dg/debug/dwarf2/array-2.C
trunk/gcc/testsuite/g++.dg/debug/dwarf2/array-3.C
trunk/gcc/testsuite/g++.dg/debug/dwarf2/array-4.C
trunk/gcc/testsuite/gcc.dg/debug/dwarf2/array-0.c
trunk/gcc/testsuite/gcc.dg/debug/dwarf2/array-1.c
trunk/gcc/testsuite/gcc.dg/debug/dwarf2/array-2.c
trunk/gcc/testsuite/gcc.dg/debug/dwarf2/array-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-bugs
mailing list