Several test cases in g++.dg/debug/dwarf2 don't work when -fdebug-types-section is enabled. In all but one case, the test cases are fine and -fdebug-types-section works fine -- it's just that the patterns in the assembly code don't match when the option is on. I'm committing the following patch to force -fno-debug-types-section for these cases so that they're independent of any change to the default or an overriding option when running the test suite.
In the one remaining case -- pubnames-2.C -- I found a real bug in the generation of the pubnames tables when -fdebug-types-section is on, and I'll follow up with a fix for that. -cary 2013-04-18 Cary Coutant <ccout...@google.com> gcc/testsuite/ * g++.dg/debug/dwarf2/typedef2.C: Add -fno-debug-types-section flag. * g++.dg/debug/dwarf2/typedef4.C: Likewise. * g++.dg/debug/dwarf2/static-data-member1.C: Likewise. * g++.dg/debug/dwarf2/global-used-types-1.C: Likewise. * g++.dg/debug/dwarf2/self-ref-1.C: Likewise. * g++.dg/debug/dwarf2/nested-2.C: Likewise. * g++.dg/debug/dwarf2/typedef1.C: Likewise. * g++.dg/debug/dwarf2/namespace-2.C: Likewise. * g++.dg/debug/dwarf2/integer-typedef.C: Likewise. * g++.dg/debug/dwarf2/self-ref-2.C: Likewise. * g++.dg/debug/dwarf2/explicit-constructor.C: Likewise. Index: testsuite/g++.dg/debug/dwarf2/typedef2.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/typedef2.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/typedef2.C (working copy) @@ -1,5 +1,5 @@ // Origin: PR debug/43628 -// { dg-options "-g -dA" } +// { dg-options "-g -dA -fno-debug-types-section" } // { dg-do compile } // { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_formal_parameter\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type\[\n\r\]{1,2}" 1 } } Index: testsuite/g++.dg/debug/dwarf2/typedef4.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/typedef4.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/typedef4.C (working copy) @@ -1,5 +1,5 @@ // Origin: PR debug/45171 -// { dg-options "-g -dA -fno-eliminate-unused-debug-types" } +// { dg-options "-g -dA -fno-eliminate-unused-debug-types -fno-debug-types-section" } // { dg-do compile } // There should be 2 real instances of byte_size -- one for the Index: testsuite/g++.dg/debug/dwarf2/static-data-member1.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/static-data-member1.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/static-data-member1.C (working copy) @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-g -dA -fno-merge-debug-strings" } +// { dg-options "-g -dA -fno-merge-debug-strings -fno-debug-types-section" } struct A { Index: testsuite/g++.dg/debug/dwarf2/global-used-types-1.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/global-used-types-1.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/global-used-types-1.C (working copy) @@ -1,5 +1,5 @@ // Contributed by Dodji Seketeli <do...@redhat.com> -// { dg-options "-g -dA -fno-merge-debug-strings" } +// { dg-options "-g -dA -fno-merge-debug-strings -fno-debug-types-section" } // { dg-do compile } // { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumeration_type" 1 } } // { dg-final { scan-assembler-times "DIE \\(0x\[^\n\]*\\) DW_TAG_enumerator" 2 } } Index: testsuite/g++.dg/debug/dwarf2/self-ref-1.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/self-ref-1.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/self-ref-1.C (working copy) @@ -1,6 +1,6 @@ // Origin: PR debug/45088 // { dg-do compile } -// { dg-options "-g -dA" } +// { dg-options "-g -dA -fno-debug-types-section" } // { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } } struct A Index: testsuite/g++.dg/debug/dwarf2/nested-2.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/nested-2.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/nested-2.C (working copy) @@ -1,6 +1,6 @@ /* Origin: PR debug/45024 - { dg-options "-g -dA -fno-merge-debug-strings" } + { dg-options "-g -dA -fno-merge-debug-strings -fno-debug-types-section" } { dg-do compile } */ Index: testsuite/g++.dg/debug/dwarf2/typedef1.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/typedef1.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/typedef1.C (working copy) @@ -1,6 +1,6 @@ // Contributed by Dodji Seketeli <do...@redhat.com> // Origin: PR c++/40705 -// { dg-options "-g -dA" } +// { dg-options "-g -dA -fno-debug-types-section" } // { dg-do compile } // { dg-final { scan-assembler-times "DW_TAG_structure_type" 2 } } // { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"|\"foo<1u>..\"\[^\n\]*DW_AT_name" 1 } } Index: testsuite/g++.dg/debug/dwarf2/namespace-2.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/namespace-2.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/namespace-2.C (working copy) @@ -1,6 +1,6 @@ // Test that we define A inside the namespace rather than declaring it // there and then defining it at CU scope. -// { dg-options "-g -dA" } +// { dg-options "-g -dA -fno-debug-types-section" } // { dg-final { scan-assembler-not "DW_AT_declaration" } } namespace N { Index: testsuite/g++.dg/debug/dwarf2/integer-typedef.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/integer-typedef.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/integer-typedef.C (working copy) @@ -1,5 +1,5 @@ // Origin: PR debug/49130 -// { dg-options "-g -dA -fno-merge-debug-strings" } +// { dg-options "-g -dA -fno-merge-debug-strings -fno-debug-types-section" } typedef long unsigned int size_t; static const size_t foo = 2048; Index: testsuite/g++.dg/debug/dwarf2/self-ref-2.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/self-ref-2.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/self-ref-2.C (working copy) @@ -1,6 +1,6 @@ // Origin: PR debug/45088 // { dg-do compile } -// { dg-options "-g -dA" } +// { dg-options "-g -dA -fno-debug-types-section" } // { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_pointer_type\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_byte_size\[\n\r\]{1,2}\[^\n\r\]*DW_AT_type" 4 } } template<class T> Index: testsuite/g++.dg/debug/dwarf2/explicit-constructor.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/explicit-constructor.C (revision 198034) +++ testsuite/g++.dg/debug/dwarf2/explicit-constructor.C (working copy) @@ -1,7 +1,7 @@ // Contributed by Dodji Seketeli <do...@redhat.com> // Origin: PR c++ // { dg-do compile } -// { dg-options "-O -g -dA -gno-strict-dwarf" } +// { dg-options "-O -g -dA -gno-strict-dwarf -fno-debug-types-section" } // { dg-final { scan-assembler-times "DW_AT_explicit" 2 } } struct Foo