🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #18

gdb4.7 lossage on enum bitfields

#18
From: Robert R. Henry
Date: Wed, 28 Oct 1992 17:08
31 lines
1153 bytes
gdb4.7 target==sparc, host==sparc (g++ from gcc2.2.2) does
a sign extension when it extracts enumerations contained in bit fields;
gdb4.6 does not do the sign extension, and neither does gcc from gcc2.2.2.
(Note that enums contained in bitfields are legal in c++, since they
are integral types)

For the program at the bottom,
breaking at the first printf in main,
and doing
  (gdb4.7) print e
  $1 = {
    x = -2
  }
  (gdb4.7) print u
  $2 = {
    x = 2
  }
whereas in gdb4.6 doing the same thing:
  (gdb4.6) print e
  $1 = {
    x = VAL2
  }
  (gdb4.6) print u
  $2 = {
    x = 2
  }
is better, and agrees in the sign-extendedness behaviour
with the output of executing the program:
  VAL2 = 2
  e.x = 2
  u.x = 2
Technical Details
Message-ID: <9210281708.AA27547@tera.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrh

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tera.com!rrh
From: rrh@tera.com (Robert R. Henry)
Subject: gdb4.7 lossage on enum bitfields
Message-ID: <9210281708.AA27547@tera.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 28 Oct 1992 17:08:42 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 32