Article View: gnu.gdb.bug
Article #325&& bug
From: Michael Tiemann
Date: Sun, 19 Nov 1989 23:35
Date: Sun, 19 Nov 1989 23:35
57 lines
2218 bytes
2218 bytes
Date: Sun, 19 Nov 89 15:36:34 PST
From: raulmill%aludra.usc.edu@usc.edu (Raul Deluth Rockwell)
Code:
a->Rest_Length = t /* refigure length count */
&& 1 + a->Rest->Rest_Length;
Code purpose: If t is a null pointer, count is zero, otherwise count
indicates list length.
Problem: works fine for generating a->Rest_Length = 0 or
a->Rest_Length = 1, won't make a->Rest_Length = 2.
Types:
struct arg_list_struct {
unsigned Line;
char * Source;
union {
signed short Integer;
unsigned Coord;
struct arg_list_struct * List;
char * String;
struct sym_struct * Sym;
} Arg;
arg_type_t Arg_Type; /* an enum */
struct arg_list_struct * Rest;
unsigned Rest_Length;
} *a, *t;
compiler version: gcc version 1.36
compiler options: -g -sun4
environment: Sun-4/260 with 32 MB of memory, running SunOS Release 4.0.3-GFX
steps taken to verify presence of compiler problem rather than user
problem: ran offending computation through gdb (gdb gave 2 where
compiled code gave 1).
Raul Rockwell
INTERNET: raulmill@usc.edu !
UUCP: ...uunet!usc!raulmill ! 55 mph = 82 nc
U.S.SNAIL: 721 E Windsor #4, GLENDALE CA 91205 !
This is pilot error: the result of an && expression always evaluates
to 0 or 1. Since GCC is right and GDB is wrong, it is a GDB bug.
To Raul, this is what you want:
Code:
/* refigure length count */
a->Rest_Length = (t ? 1 + a->Rest->Rest_Length : 0);
Code purpose: If t is a null pointer, count is zero, otherwise count
indicates list length.
Michael
Technical Details
Message-ID:
<8911192335.AA14988@lurch.Stanford.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!LURCH.STANFORD.EDU!tiemannReferences:
<8911192336.AA16405@aludra.usc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!LURCH.STANFORD.EDU!tiemann From: tiemann@LURCH.STANFORD.EDU (Michael Tiemann) Newsgroups: gnu.gdb.bug Subject: && bug Message-ID: <8911192335.AA14988@lurch.Stanford.EDU> Date: 19 Nov 89 23:35:46 GMT References: <8911192336.AA16405@aludra.usc.edu> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 57