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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!water!watmath!clyde!rutgers!princeton!udel!gatech!ncsuvx!mcnc!ecsvax!tpmsph From: tpmsph@ecsvax.UUCP (Thomas P. Morris) Newsgroups: comp.lang.ada Subject: Re: optimizating compilers (VMS ADA) Summary: Pity ALM didn't specify semantics; constants; optimization Message-ID: <4464@ecsvax.UUCP> Date: 22 Jan 88 04:11:20 GMT References: <8801201714.AA15107@ajpo.sei.cmu.edu> Organization: UNC Educational Computing Service List-Id: In article <8801201714.AA15107@ajpo.sei.cmu.edu>, TENE@TECHMAX.BITNET writes: > In reply to Norman Cohen: > ... These examples should have been erroneous (I am not sure > they can be classified as errors since it would be hard to detect them > at compilation time) but even when they are not erroneous they are > bad-programming. I don't believe the code in the original example was erroneous. Where in the LRM does it classify the actions of that code as erroneous? If anything, the compiler's optimization ought to be considered erroneous, tenously in violation of LRM 3.2.1.6-8 (object elaboration rules), in that the "initial value" obtained by evaluation of the explicit initialization should be the CONTENTS of the STRING pointed to, not the ADDRESS of the STRING pointed to. Yes, I know that most compilers and runtimes consider a string and its address as one and the same thing. But compile-time semantic checks should not do so. Structure-sharing between the physical storage occupied by a constant and a variable must be erroneous, although there is no explicit statement in the LRM to that effect. > I understand and passively support the "strict constructionist" attitude. > I agree that ADA (which started out this way) could (and maybe should) > have gone all the way and defined a strict language semantics. > Mathematical rigor in the design of programming languages, probably would > increase the number of truly safe and legal optimizations which would > then make the need for unsafe optimization less critical. > Definition of strict language sematics would certainly have helped greatly in this case. As above, if strict semantics had been defined, it would have been quite clear that the compiler ought not to share storage occupied by a variable (A.all) and a constant. Tom Morris