From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ce37c95571e5f88 X-Google-Attributes: gid1164f8,public From: Marc Lepage Subject: Re: Is ladebug sane?! Date: 1998/01/28 Message-ID: <34CF46A9.E1FE002B@cgocable.net>#1/1 X-Deja-AN: 319976389 Content-Transfer-Encoding: 7bit References: <34C4B69B.6E1AF936@cgocable.net> <34CDFF21.41C6@zko.dec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Infinisys Newsgroups: comp.sys.dec Jeff Diewald wrote: > > Marc Lepage wrote: > > > > Perhaps someone can explain this to me? nCount is the short parameter. > > > > (ladebug) next > > stopped at [void ALocalFile::WriteBlock(VARIANT*, short):899 > > 0x6e1e53e4] > > 899 int nCount2 = nCount; > > (ladebug) print nCount > > 31 > > (ladebug) print sizeof(nCount) > > 2 > > (ladebug) next > > stopped at [void ALocalFile::WriteBlock(VARIANT*, short):900 > > 0x6e1e53e8] > > 900 m_Stream->write((char *)pVar,nCount2); > > (ladebug) print nCount2 > > 1857749023 > > > > -- > > SEGV > > Well, it looks like a bug to me, but without additional information, > we can't tell you if it's something we've already fixed. It would > also help if you could tell us which version of Ladebug, Digital > Unix, and compiler you're using. (FYI - Ladebug version 4.0-44 is > the latest and greatest.) The SEGV traceback information is also > of interest. Can you reproduce the problem in a smaller example you > can send to us? > > We've done a lot of work to improve our quality of late. Your fix > might be as easy as an upgrade of Ladebug. Thanks all. As everyone has pointed out, the lower bytes are correct. I know that, I was more concerned about the upper incorrect bytes. :-) Printfs and couts yield the incorrect result, unless I do a printf with "%h", since the printf function then only really does look at the two bytes. Assigning to a temporary short and then to an int works. The problem, as it turned out, is that the first short came in through a parameter, and that parameter was being marshalled by some third-party software. I suppose I phrased my subject wrong. Ladebug is correct, but I wondered why then the compiler was producing wrong results. When assigning a short, why was it looking at the other bytes? I guess it assumes it is packed into an int for the parameter. Anyhow, the third party has fixed the code and now it works. But I'm still curious... what are the restrictions on the upper bytes when a short is placed on the stack? PS: The SEGV is my alias. :-) -- SEGV