Article View: gnu.g++.bug
Article #1373Problem with optimized inline functions
From: John David Anglin
Date: Fri, 08 Jan 1993 22:25
Date: Fri, 08 Jan 1993 22:25
24 lines
1254 bytes
1254 bytes
The following inline function taken from the file BitString.h in the
libg++-2.3 distribution does not compile properly with gcc -O (version
2.3.3) on a HP Apollo 9000 series 700 running hpux 8.07:
inline BitString shorttoBitString(unsigned short w) return r
{
r.rep = BStr_alloc(0, &w, 0, BITSTRBITS, BITSTRBITS);
}
Routines (e.g., tBitString) using this inline function dump core. The
problem seems to be in the evaluation of the address of w. Using a
temporary variable for w circumvents the problem:
inline BitString shorttoBitString(unsigned short w) return r
{
unsigned short u = w;
r.rep = BStr_alloc(0, &u, 0, BITSTRBITS, BITSTRBITS);
}
There is a similar problem taking the address of a character variable
in the module String.h.
Dave Anglin
National Research Council of Canada
Technical Details
Message-ID:
<9301082227.AA17168@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hiauly1.hia.nrc.ca!daveShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hiauly1.hia.nrc.ca!dave From: dave@hiauly1.hia.nrc.ca (John David Anglin) Subject: Problem with optimized inline functions Message-ID: <9301082227.AA17168@life.ai.mit.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 8 Jan 1993 22:25:59 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 25