Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Chris Chiesa <lvt-cfc@servtech.com>
Subject: Re: pow() Alpha problem (from Risks Digest, InfoWorld)
Date: 1997/08/27	[thread overview]
Message-ID: <3404A338.7798@servtech.com> (raw)
In-Reply-To: 5tkqjn$a14@usenet.pa.dec.com


Stephen Hoff Hoffman wrote:
> 
> "Digital has investigated the issue surrounding the pow() function returning
> different results on two Digital Alpha systems, which was highlighted in
> the InfoWorld article from July 21, 1997.  Digital was unable to verify,
> duplicate or confirm that there is a problem in any of our hardware, and we
> strongly believe that this was an isolated issue pertaining to one system.
> There have been no additional problems reported to Digital pertaining to
> this matter."
> 
>   Background: The first widely-distributed report of a problem with the
>   pow() routine on a particular system I am aware of was made in Risks
>   Digest 19.24.  This initial report was apparently submitted by Gregory
>   F. March, and -- per a later message in Risks Digest -- was resolved
>   after an on-site repair visit by a DIGITAL service representative;
>   the pow() function is now operating as expected.

For what it's worth, I just now encountered a weird situation on an
Alpha (not
sure precisely which "model") CPU running <cringe> Windows NT 3.51,
while 
developing an ANSI C program using <cringe> Microsoft Visual C++ 2.0. 
Is any-
one here interested in hearing the details?  Anyone think he/she might
be able
to shed some light on it if I go into detail?  If so, read on.  If not,
feel
free to bail right now.  And if you DO have something to add, please
e-mail me
even if you ALSO POST, as my newsfeed here is very unstable and I rarely
see 
even my OWN articles, much less any FOLLOWUPS.  I thank you in advance
and 
will happily do the same for YOU someday if and when you request it in
an area
where I can be of help.

Details follow.

Scenario:  Compiling, linking, and executing ANSI C "console
application" in
MSVC++ (2.0) environment.  Upon attempting to execute a statement
involving 
a test-for-inequality between two entries in a two-dimensional array of 
double (displayed in Locals Window as 3.0000000000000 and
0.20000000000000
respectively, which is AS EXPECTED), the app pops up the message

	"Unhandled Exception in <appname>: 0xC0000090: Float Invalid Option"

and essentially "crashes."

Investigation: MSVC++ Debugger's Disassembly Window reveals the
offending 
instruction as

	cmptlt	psr,f0,psr

I don't recognize Alpha register-name "psr," and Alpha Architecture
Handbook 
does not list it.  Register Window lists many similarly unfamiliar
register-
names: "v0," "t0" through "t12," "s0" through "s5," "a0" through "a5,"
"ra,"
"fir," "fpcr," and "softFpcr."  FWIW, _no_ "pc" appears; instruction's 
address is observed in register "fir."  Contents of register "psr" are
displayed
as

   psr = 00000003 mode=1 ie=1 irq1=0 int5=0 int4=0 int3=0 int2=0 int1=0
int0=0

and of register "f0" as

   f0 = +3.00000000000000E+000

Memory at instruction's PC contains longword

	0x580114C0

Hand-disassembly against Alpha Architecture Handbook discloses
instruction
characteristics/properties:

	  Opcode: 0x16 -- IEEE FP instruction
	      Fa: 0
	      Fb: 1
	Function: 0x0A6 ==> CMPTLT
	      Fc: 0

Instruction would _seem_ to disassemble as

	CMPTLT	F0,F1,F0

Contents of register "f1" are displayed as

   f1 = +4.94065645841247E-324


Discussion: The good news is that both the MSVC++ Debugger and I
disassemble
the offending instruction to the same opcode: CMPTLT ("Compare
T_floating 
Less Than"), which correlates well with the "double-comparison" portion
of
the source statement.  The bad news is everything else.  To wit:

  - MSVC++ disassembles the instruction as referencing "f0" once and 
    "psr" twice, whereas I disassemble it as referencing "F0" twice and
    "F1" twice.  At first glance one assumes that "f0" <--> "F0", but
    this is inconsistent with the two different disassemblies.  The 
    only possible conclusion, but a disturbing one, is that "f0" <-->
"F1"
    and "psr" <--> "F0".  Does anyone know whether that is correct, or
    even possible?  NT/MSVC++ seem to have a penchant for "renaming" the
    Alpha registers...

  - It doesn't seem to make much sense to perform a comparison (CMPTLT
    instruction) between two registers ("psr" and "f0") whose values 
    MSVC++ displays in such different formats; clearly, "f0" is a float-
    ing-point register, and indeed it appears to contain an (IEEE?) FP
    value appropriate to the source-level variable on the left-hand
    side of the comparison expression.  But "psr" is almost just as 
    clearly NOT an FP register of ANY stripe -- and the FP value of the
    variable on the RIGHT-hand side of the source expression is not in
    evidence in ANY of the displayed "FP registers."  

It almost appears that the code has been somehow "miscompiled."  That
would
have to be a bug in MSVC++.  Moreover, this SAME SOURCE STATEMENT
compiles, links,
and EXECUTES PROPERLY, in another application that uses a slight
modification
of the SAME SOURCE FILE.  (Alas, I do not currently have that
application built
nor buildable, having LOST the "original" source file in the course of
making
the "modified" one.)

I would be VERY interested in any light that anyone might be able to
shed on 
this.  I would also be very interested in any suggestions of OTHER
PLACES TO 
GO for help with this situation!  The only alternative I can currently
envision,
is to outright REPLACE my Alpha NT system with an <cringe> INTEL system.
:-(

Thanks in advance,
    Chris Chiesa
    lvt-cfc@servtech.com
    displayed in such drastically different formats in the Register Win-
    dow



       reply	other threads:[~1997-08-27  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5tkqjn$a14@usenet.pa.dec.com>
1997-08-27  4:00 ` Chris Chiesa [this message]
1997-08-28  4:00 ` pow() Alpha problem (from Risks Digest, InfoWorld) Dave Green
1997-08-28  4:00   ` fun and games with 11/40 microcode (was Re: pow() Alpha problem (from Risks Digest, InfoWorld)) Mark Bartelt
     [not found]     ` <3406047E.F469FE7F@bcl-anon.co.nz>
     [not found]       ` <tater-skins-ya023180003008971305560001@news.patriot.net>
1997-09-02  4:00         ` Dave Green
     [not found]   ` <5uk5ap$spq@milo.mcs.anl.gov>
1997-09-04  4:00     ` fun and games with 11/40 microcode (was Re: pow() Alpha problem Joe Landis
1997-09-05  4:00       ` Alan Frisbie
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox