From a33c3013e80383342825c1af7fad2a6f3979ceee Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 29 Dec 2006 20:36:38 +0000 Subject: [PATCH] Correct result for whole address range in compare_modules. --- libdwfl/ChangeLog | 6 ++++++ libdwfl/dwfl_module.c | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index f70c3397f..50e9e1bb9 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,9 @@ +2006-12-29 Ulrich Drepper + + * dwfl_module.c (compare_modules): Do not try to be smart and use + subtraction which can lead to wrong results. + Patch by Frank Eigler . + 2006-10-30 Roland McGrath * dwfl_module.c (dwfl_report_module): Comment typo fix. diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c index 5990b7550..0cccb5c09 100644 --- a/libdwfl/dwfl_module.c +++ b/libdwfl/dwfl_module.c @@ -172,10 +172,9 @@ compare_modules (const void *a, const void *b) if (m2 == NULL) return 1; - GElf_Sxword diff = m1->low_addr - m2->low_addr; - if (diff < 0) + if (m1->low_addr < m2->low_addr return -1; - if (diff > 0) + if (m1->low_addr > m2->low_addr) return 1; return 0; } -- 2.47.2