🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #862

Re: Long long, optimization and weird debugger errors

#862
From: Jason Botwick
Date: Thu, 23 Jan 2003 12:04
39 lines
2773 bytes
void TBlockStreamDocument::ReserveDiskSpace(long long &requestedSpace)
{
    HParamBlockRec pb;
    long long freeBytes;

    BlockZero_AC(pb);

    if (fDocStream->GetFile()->GetVolumeInfo(pb) == noErr)
    {
        // pb.*.* are both unsigned longs that return the amount
        // of free disk blocks and the size of these blocks, respectively.

        long long ioVFrBlk = pb.volumeParam.ioVFrBlk;
        long long ioVAlBlkSiz = pb.volumeParam.ioVAlBlkSiz;
        freeBytes = ioVFrBlk * ioVAlBlkSiz;
    }
    else
        freeBytes = 0;
    
    if (freeBytes < requestedSpace)
        requestedSpace = 0;
}

I forgot to mention that this code is running on x86.

And the problem isn't so much that the debugger isn't tracking the correct
values of the variables as it is that the value of freeBytes is coming out
to zero when I use optimization level 4.

If I reduce the optimization level to 1-3, the value of freeBytes is set to
the lo bytes. In the debugger, I can see where the freeBytes is split up
into lo and hi bytes, and the hi bytes are set to zero. In other words,
anytime freeBytes is greater than 0xFFFFFFFF, the high bytes are cut off.

Last night I tested this code on some different machines (different
processors), and found that even at optimization level 0, the hi bytes of
freeBytes is ignored.

Any ideas on why this would be?  
Technical Details
Message-ID: <BA554463.75A8%jbotwick@nc.rr.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!snoopy.risq.qc.ca!nf3.bellglobal.com!cyclone.mw.ipsvc.net!news.mw.ipsvc.net!cyclone.kc.rr.com!news-west.rr.com!cyclone.austin.rr.com!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!twister.southeast.rr.com.POSTED!53ab2750!not-for-mail
References: <BA54E438.7596%jbotwick@nc.rr.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,9970b840368bc3e
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,9970b840368bc3e
X-Google-Attributes: gidf635e,public
X-Google-Thread: fd047,9970b840368bc3e
X-Google-Attributes: gidfd047,public
X-Google-ArrivalTime: 2003-01-23 04:04:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!snoopy.risq.qc.ca!nf3.bellglobal.com!cyclone.mw.ipsvc.net!news.mw.ipsvc.net!cyclone.kc.rr.com!news-west.rr.com!cyclone.austin.rr.com!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!twister.southeast.rr.com.POSTED!53ab2750!not-for-mail
User-Agent: Microsoft-Entourage/10.0.0.1309
Subject: Re: Long long, optimization and weird debugger errors
From: Jason Botwick <jbotwick@nc.rr.com>
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac,codewarrior.windows
Message-ID: <BA554463.75A8%jbotwick@nc.rr.com>
References: <BA54E438.7596%jbotwick@nc.rr.com>
Mime-version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit
Lines: 40
Date: Thu, 23 Jan 2003 12:04:02 GMT
NNTP-Posting-Host: 66.26.80.68
X-Complaints-To: abuse@rr.com
X-Trace: twister.southeast.rr.com 1043323442 66.26.80.68 (Thu, 23 Jan 2003 07:04:02 EST)
NNTP-Posting-Date: Thu, 23 Jan 2003 07:04:02 EST
Organization: Road Runner - NC