]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests/low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
authorMark Wielaard <mjw@redhat.com>
Mon, 7 May 2012 11:29:52 +0000 (13:29 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 7 May 2012 11:29:52 +0000 (13:29 +0200)
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.

tests/ChangeLog
tests/low_high_pc.c

index abc73400b7c1537daca76d7f492d2dabd14f135e..4c6e9f7f865c4880dcc05cf7bf119b6798c261f5 100644 (file)
@@ -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
index 3054046b4035c424eb92f81f5a4565690e84a574..6fc8b15440840c52f274ef5a8b964d4a8b784456 100644 (file)
@@ -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");