This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/46954] New: FDEs possibly left unsorted in unwind-dw2-fde.c
- From: "jvoung at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Dec 2010 04:11:53 +0000
- Subject: [Bug other/46954] New: FDEs possibly left unsorted in unwind-dw2-fde.c
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46954
Summary: FDEs possibly left unsorted in unwind-dw2-fde.c
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jvoung@google.com
Not completely sure if this is a bug in GCC or my toolchain, but I have been
able to trigger a situation where _Unwind_Find_FDE is unable to find an FDE. In
my case, the reason is that the FDEs are only partially sorted even though
"ob->s.b.sorted = 1", so the binary search (binary_search_mixed_encoded_fdes in
particular) fails.
By patching end_fde_sort() with:
--- a/llvm-gcc-4.2/gcc/unwind-dw2-fde.c
+++ b/llvm-gcc-4.2/gcc/unwind-dw2-fde.c
@@ -588,6 +588,11 @@
fde_split (ob, fde_compare, accu->linear, accu->erratic);
gcc_assert (accu->linear->count + accu->erratic->count == count);
frame_heapsort (ob, fde_compare, accu->erratic);
+ frame_heapsort (ob, fde_compare, accu->linear);
fde_merge (ob, fde_compare, accu->linear, accu->erratic);
free (accu->erratic);
}
The FDEs are fully sorted and binary search succeeds.
I don't know the code well at all, but is the patch correct, or should
accu->linear already be sorted? In the else-branch, the code does a heap sort
on accu->linear, which leads me to believe that it accu->linear may be unsorted
(and so should be sorted as well).