This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: tests/low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.


I pushed the following. Although the bug is fixed in GCC 4.7 that has
only been released last month. Most distros are still based on 4.6 or
lower.

commit d9bc75fc20f0ce5064cac192a518af3c7192e96d
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon May 7 13:29:52 2012 +0200

    tests/low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
    
    GCC < 4.7 had a bug where no code CUs got a highpc == lowpc.
    Allow that, because it is not the main purpose of this test.

diff --git a/tests/ChangeLog b/tests/ChangeLog
index abc7340..4c6e9f7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-07  Mark Wielaard  <mjw@redhat.com>
+
+	* low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
+
 2012-04-27  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (TESTS): Add run-low_high_pc.sh
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index 3054046..6fc8b15 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
@@ -72,9 +72,12 @@ handle_die (Dwarf_Die *die, void *arg)
   if (dwarf_highpc (die, &highpc) != 0 && dwarf_hasattr (die, DW_AT_high_pc))
     fail (off, name, "has DW_AT_high_pc but dwarf_highpc fails");
 
+  /* GCC < 4.7 had a bug where no code CUs got a highpc == lowpc.
+     Allow that, because it is not the main purpose of this test.  */
   if (dwarf_hasattr (die, DW_AT_low_pc)
       && dwarf_hasattr (die, DW_AT_high_pc)
-      && highpc <= lowpc)
+      && highpc <= lowpc
+      && ! (dwarf_tag (die) == DW_TAG_compile_unit && highpc == lowpc))
     {
       printf("lowpc: %lx, highpc: %lx\n", lowpc, highpc);
       fail (off, name, "highpc <= lowpc");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]