From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c32f54b2230c68d7 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Compilers for VAX Was: Ada version of C's 'static' Date: 1999/08/10 Message-ID: #1/1 X-Deja-AN: 511026594 Sender: bobduff@world.std.com (Robert A Duff) References: <7n03us$862$1@nnrp1.deja.com> <3798EDE9.90B9623B@averstar.com> <1999Aug6.130439.1@eisner> <7on41u$3rf@dfw-ixnews19.ix.netcom.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-08-10T00:00:00+00:00 List-Id: Richard D Riehle writes: > Not easy. Not necessarily safe. I just discovered that another > favorite language that emits intermediate C code fails to detect > the famous C "integer overflow" problem at run-time. The AdaMagic compiler correctly handles integer overflow. For efficiency, we need to tailor this part of the compiler to the specific target. We also have a completely portable (but less efficient) mechanism. And we also have a high-level optimizer that's pretty good at removing overflow checks entirely (which is of course most efficient). This is part of what I meant by "non-zero work". But it's still substantially faster to port this compiler than to a new C compiler than to write a completely new code generator. (Our front end also has targets supported in that more traditional way.) >... Even though > C is sometimes thought of as a "universal assembler" suitable for > "C Pass" compilers, ... It's kind of annoying to hear C called a "universal assembler" when it can't deal with integer overflow nearly as well as any real assembly language I've used. >... one needs to ensure that the rigorous demands > of Ada are still satisfied. I guess conformance (ACVC) tests are > still useful. Indeed. There's no way we could get away without properly implementing overflow -- there are dozens of ACVC tests that would fail. Er, I mean, ACATS tests. Another "interesting" issue is stack overflow detection. The SHARC chip has a zero-overhead mechanism built into the hardware, but of course standard C doesn't give us any direct access to that -- we had to write a little bit of assembly code. - Bob -- Change robert to bob to get my real email address. Sorry.