Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: VAX: Another small GAS bug?



On Sun, 2024-04-07 12:09:17 +0100, Maciej W. Rozycki <macro%orcam.me.uk@localhost> wrote:
> On Sun, 7 Apr 2024, Kalvis Duckmanton wrote:
> 
> > >    Unfortunately, I guess I'll only have time for this in a month or
> > > the like, maybe you, or Kalvin, or Anders, or Martin, or Maciej, or
> > > Mouse, or ... may want to have a look?  Esp, since it happened in a
> > > regular CI build, but I was unable (in a few-minutes attempt) to
> > > reproduce it. :-/  I'd like to make sure there isn't much more hidden
> > > behind this issue.
> > 
> > So I had a look today.  I don't believe GAS is at fault; it has assembled an
> > F-floating zero (so 32 bits wide) ... into the lower part of a buffer big
> > enough to hold a quadword (64 bits) or a D-floating value (again 64 bits). 
> > The other 32 bits in that buffer, which are mantissa bits in the D-floating
> > type, are not initialised.  As rin points out, VAX looks only at the sign and
> > exponent fields to determine whether a value is a zero.
> 
>  I can't say offhand what the VAX assembly language semantics is here, but 
> I find the use of uninitialised data for an instruction operand clearly a 
> bug in GAS (and then a rather nasty one).

https://sourceware.org/bugzilla/show_bug.cgi?id=31617

Shouldn't be too hard to check immediates at least to match the
expected size.

>  I think the tool is supposed to either reject an immediate F-floating 
> operand given to an instruction that operates on D-floating data or make 
> an arithmetic conversion of the operand to correctly represent it in the 
> D-floating format.  Likewise for other data format mismatches.

ACK.

>  What actually to do I'd expect to see in the VAX assembly language 
> reference specification.  If not fixed right away, this needs to be filed 
> as a bug upstream, so that we don't forget about it.

=== VAX MACRO and Instruction Set Reference Manual =========================
=== AA–PS6GD–TE ============================================================
2.3 Operand Field:
Operands for a macro must meet the requirements specified in the macro
definition. See the description of the .MACRO directive in Chapter 6.

----------------------------------------------------------------------------

3.2.2 Floating-Point Numbers:
A floating-point number can be used in the .F_FLOATING
(.FLOAT),.D_FLOATING (.DOUBLE), .G_FLOATING, and .H_FLOATING
directives (described in Chapter 6) or as an operand in a
floating-point instruction. A floating-point number cannot be used in
an expression or with a unary or binary operator except the unary
plus, unary minus, and unary floating-point operator, ^F (F_FLOATING).
Section 3.6 and Section 3.7 describe unary and binary operators.

A floating-point number can be specified with or without an exponent.

*Formats*
Floating-point number without exponent:
	snn
	snn.nn
	snn.

Floating-point number with exponent:
	snnEsnn
	snn.nnEsnn
	snn.Esnn

  *s* An optional sign.
  *nn*	A string of decimal digits in the range of 0 to 9.

The decimal point can appear anywhere to the right of the first digit.
Note that a floating-point number cannot start with a decimal point
because VAX MACRO will treat the number as a user-defined symbol (see
Section 3.3.2).

Floating-point numbers can be single-precision (32-bit),
double-precision (64-bit), or extended-precision (128-bit) quantities.
The degree of precision is 7 digits for single-precision numbers, 16
digits for double-precision numbers, and 33 digits for
extended-precision numbers.

The magnitude of a nonzero floating-point number cannot be smaller
than approximately 0.29E-38 or greater than approximately 1.7E38.

Single-precision floating-point numbers can be rounded (by default) or
truncated.  The .ENABLE and .DISABLE directives (described in Chapter
6) control whether single-precision floating-point numbers are rounded
or truncated.  Doubleprecision and extended-precision floating-point
numbers are always rounded.

Section 8.3.6, Section 8.3.7, Section 8.3.8, and Section 8.3.9
describe the internal format of floating-point numbers.
============================================================================

The format used by GAS is actually a GAS extension, cf.
gas/doc/c-vax.texi, which would benefit from some clarifications as
well.

MfG, JBG

-- 

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index