🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #2090

Re: uninitialized variable checking

#2090
From: Steve Hanson
Date: Sat, 02 Sep 1989 17:07
33 lines
1988 bytes
In article <3248@itivax.iti.org>, dhw@itivax (David H. West) writes:
>I've seen a few debugging compilers (on mainframes) which just
>reserve an infrequently used normal value to mean 'uninitialized',
>initialize variables to this, and check for it before each use.
>True, you were then out of luck if you *really* wanted -1.3E-38 (real) 
>or -2^32 (4 byte int) or whatever, but then you were out of luck anyway 
>if you wanted -1E39 or -2^32 -1.
>
>There's no reason this trick woudn't work on micros, but there would
>be losses in speed, code size and the feasibility of certain hacks.  
>I think this is acceptable so long as the trick can be disabled.  In
>fact, I'm surprised that Borland haven't done it.
>
>-David West         dhw@itivax.iti.org





The 2.10 MIPS Compiler via an option initializes local memory and
malloc'ed memory to NaN's and enables the Invalid Operation
Exception in the floating point control/status register. An invalid
operation exception is signaled if any arithmetic operation is applied
to a signaling NaN. The signal together with the debugger gives the
user some idea where things start going bad. 

Granted this only works for floating point, but nevertheless it's
helpful, requires no additional hardware, no compiler checking 
and applies across languages.

This idea was contributed by Meta-Software, Inc. makers of HSPICE,
an industrial compute-intensive, circuit simulator written in fortran.
-- 
Technical Details
Message-ID: <26762@gumby.mips.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!vsi1!daver!mips!sah@gumby
References: <12.filbo@gorn.santa-cruz.ca.us> <4322@druhi.ATT.COM> <3248@itivax.iti.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!vsi1!daver!mips!sah@gumby
From: sah@gumby (Steve Hanson)
Newsgroups: comp.arch
Subject: Re: uninitialized variable checking
Message-ID: <26762@gumby.mips.COM>
Date: 2 Sep 89 17:07:24 GMT
References: <12.filbo@gorn.santa-cruz.ca.us> <4322@druhi.ATT.COM> <3248@itivax.iti.org>
Sender: sah@mips.COM
Reply-To: sah@gumby (Steve Hanson)
Organization: MIPS Computer Systems, Sunnyvale CA
Lines: 33
In-reply-to: dhw@itivax.iti.org (David H. West)