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,b084786fb95b5938,start X-Google-Attributes: gid103376,public From: claveman@cod.nosc.mil (Charles H. Sampson) Subject: Adding Things to Package System Date: 1999/02/18 Message-ID: <1999Feb18.192159.18832@nosc.mil>#1/1 X-Deja-AN: 445795205 Sender: news@nosc.mil Organization: Computer Sciences Corporation Newsgroups: comp.lang.ada Date: 1999-02-18T00:00:00+00:00 List-Id: I've just come across what looks like an interesting bug in both the Green Hills and ObjectAda compilers. While the bug itself is inter- esting, the questions it raises are more so. The problem is illustrated by the following package: with System.Storage_elements; Package Address_arithmetic_bug is -- The following use type declaration makes -- function "+"(Left : Address; Right : Storage_offset) -- return Address; -- directly visible (among other things). use type System.Storage_elements.Storage_offset; -- The following use type declaration seems to cause the problem: use type System.Address; First_address : constant System.Address := System.Storage_elements.To_address (16#10_000#); Second_address : constant System.Address := First_address + 1; end Address_arithmetic_bug; The compilers complain that the addition of an object of type Ad- dress and an integer literal is ambiguous. They do not give any details about which "+" operations are directly visible. The code does compile o. k. under GNAT. I haven't received a reply to my bug report from Green Hills, but I suspect that a "+" operation has been added to package System that is made directly visible by the second use type clause. If so, then we have an apparent conflict in the LRM. 13.7(36) clearly allows such ad- ditions (although it discourages them), yet this is legal code that the compiler can't handle, in violation of 1.1.3(2). Am I correct in assuming that 1.1.3(2) rules? If so, then how does that paragraph reconcile with 1.1.3(6), which appears to condone the ad- dition? Offhand, it looks like any addition to System could give rise to similar problems. For example, suppose an identifier is added to System and this identifier is also used in package Pkg. Then, in the presence of use System and use Pkg clauses, that identifier would not be directly visible, although it would be for a compiler that uses the "minimal" package System. Charlie -- ****** For an email response, my user name is "sampson" and my host is "spawar.navy.mil".