From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Intermediate expressions and modular types
Date: 1997/10/18
Date: 1997-10-18T00:00:00+00:00 [thread overview]
Message-ID: <EI9BCK.G5s@world.std.com> (raw)
In-Reply-To: 344898BA.7361@dtek.chalmers.se
In article <344898BA.7361@dtek.chalmers.se>,
Martin Kristensson <d95krima@dtek.chalmers.se> wrote:
>-- Ada95
>type Modular is mod 2**32;
>procedure Test(ModA, ModB : in Modular) is
> X : Integer;
>begin
> X := Integer(ModA - ModB);
>end Test;
>
>The intermediate expression (ModA - ModB) is calculated modulo 2**32 by
>compiler A, but not by compiler B.
>Which is right?
Compiler A.
>Surely the correct behavior must be stated in the RM, but where?
Not sure what to quote here.
3.5.4(19) defines the normal "wrap-around" semantics of the "-" operator
on modular types -- in fact it talks about all operators.
So perhaps the issue is that Compiler A thinks it's a Modular "-",
whereas Compiler B thinks it's an Integer "-". The former is correct,
which follows from all the visibility and overloading rules and so
forth, but 4.6(7) says that the "-" chosen comes from the types of the
operands.
Most likely, it's just a plain old code generation bug, so there's no RM
exegesis necessary to convince the maintainers of Compiler B that they
have a bug.
Why "Compiler A" and "Compiler B"? Why can't names be named here? Is
someone afraid of being sued for saying so-and-so compiler has a bug?!
Of course, to indicate a compiler bug, one has to produce a complete
program, which prints out a wrong answer.
- Bob
prev parent reply other threads:[~1997-10-18 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-18 0:00 Intermediate expressions and modular types Martin Kristensson
1997-10-18 0:00 ` Robert A Duff [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox