This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/20: record_text_segment_lowaddr has precedence screw (hpux 64)
- To: gdb-gnats at sources dot redhat dot com
- Subject: gdb/20: record_text_segment_lowaddr has precedence screw (hpux 64)
- From: chastain at redhat dot com
- Date: 14 Feb 2001 02:34:11 -0000
- Reply-To: chastain at redhat dot com
>Number: 20
>Category: gdb
>Synopsis: record_text_segment_lowaddr has precedence screw (hpux 64)
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 13 18:38:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Michael Chastain
>Release: CVS 2001-02-12
>Organization:
>Environment:
hpux 64 bit
>Description:
File hppa_tdep.c function record_text_segment_lowaddr has a classic "a & b == b" operator precedence bug:
if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
== (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
The code as written reduces to "section->flags & 1", the same as "section->flags & SEC_ALLOC".
This is not what the author meant.
This function is used only in hpux 64 bit mode.
I found this by noticing that gcc warned about it.
I haven't traced what happens when the code executes.
>How-To-Repeat:
Build a configuration with hppa-tdep.c included and see gcc warning about it.
Any configuration, even a 32-bit configuration, will give the warning.
>Fix:
'(' ')'
Also decide whether SEC_ALLOC might really be what is intended!
>Release-Note:
>Audit-Trail:
>Unformatted: