public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4428: libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison
@ 2002-03-18  7:58 jason
  0 siblings, 0 replies; 2+ messages in thread
From: jason @ 2002-03-18  7:58 UTC (permalink / raw)
  To: dje, gcc-bugs, gcc-prs, nobody, rth

Synopsis: libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: jason
Responsible-Changed-When: Mon Mar 18 07:58:27 2002
Responsible-Changed-Why:
    he fixed it
State-Changed-From-To: open->closed
State-Changed-By: jason
State-Changed-When: Mon Mar 18 07:58:27 2002
State-Changed-Why:
    Fixed by
    
            * unwind-dw2-fde.c (fde_compare_t): Change return type to int.
            (fde_unencoded_compare): Likewise.  Don't use subtraction to get
            a tristate comparison value.
            (fde_single_encoding_compare, fde_mixed_encoding_compare): Likewise.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4428


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/4428: libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison
@ 2001-09-30 12:56 dje
  0 siblings, 0 replies; 2+ messages in thread
From: dje @ 2001-09-30 12:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4428
>Category:       c++
>Synopsis:       libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 30 12:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     dje@watson.ibm.com
>Release:        gcc-3.0.x and gcc-3.1 (pre-release)
>Organization:
>Environment:
powerpc-ibm-aix4.3.3.0
>Description:
unwind-dw2-fde.c FDE comparison routines use signed
arithmetic on addresses.  This is invalid when addresses
may have their most significant bit set, making large
addresses and differences between those values to generate
results which appear to be negative.
>How-To-Repeat:
static saddr
fde_unencoded_compare (struct object *ob __attribute__((unused)),
                       fde *x, fde *y)
{
  return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
}

Run till exit from #0  fde_unencoded_compare (ob=0x20000c40, x=0xf0105f8c,
    y=0x2000087c) at /usr/gnu/src/gcc-3.0/gcc/unwind-dw2-fde.c:298
0xd0b962ec in search_object (ob=0x20000c40, pc=0x1000036f)
    at /usr/gnu/src/gcc-3.0/gcc/unwind-dw2-fde.c:515
515                 i1--;
Value returned is $63 = -1061592376

(gdb) print/x 0xd0b96608 - 0x10000340
$138 = 0xc0b962c8
(gdb) print (int) 0xd0b96608 - 0x10000340
$139 = -1061592376
>Fix:
Do not use shortcut of signed integer comparison for
addresses.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-18 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18  7:58 c++/4428: libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison jason
  -- strict thread matches above, loose matches on Subject: below --
2001-09-30 12:56 dje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).