From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.0 required=3.0 tests=BAYES_40,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:1e95:: with SMTP id c21mr5923094qtm.306.1597332285840; Thu, 13 Aug 2020 08:24:45 -0700 (PDT) X-Received: by 2002:ac8:7094:: with SMTP id y20mr5987421qto.52.1597332285581; Thu, 13 Aug 2020 08:24:45 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 13 Aug 2020 08:24:45 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=129.27.146.70; posting-account=hMGpnwoAAABWGRVnEn8VQu1K8Uwsr5Lj NNTP-Posting-Host: 129.27.146.70 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1ab5413e-ac60-4fb7-b3bd-930de3f0fe0do@googlegroups.com> Subject: ALI Files Cross-References Inconsistency? From: Leandro Ribeiro Injection-Date: Thu, 13 Aug 2020 15:24:45 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:59714 List-Id: Hello, everyone I recently started to take a better look into Ada. I am currently analyzing .ali files. In the code snippets below (.ads and .adb), I wrote "|" to show where the ALI file claims a given symbol is. The (line X) just tells which line number the line had in my local text editor. I would expect every reference to point to the beginning of the symbol, as it is the case with "3K9*excep2". However, all other references to the symbols from excep2.ads are exactly 4 columns ahead of the "expected point". And all the references to the symbols from excep2.adb are exactly 12 columns ahead of the "expected point". Question: Is this a bug? Or did a miss any rule about adding offsets to the references? ======== excep2.ali ... X 1 excep2.ads 3K9*excep2 13l5 13e11 2|3b14 22l5 22t11 6U19*excep 7>10 8>9 8>12 9<9 10<9 2|5b19 20l13 20t18 7a10 S{string} 2|6b10 10r30 11r28 13r31 8e9 C{character} 2|6b22 13r38 8e12 Delim{character} 2|6b25 11r35 9b9 Found{boolean} 2|6b44 9m17 15m33 10i9 Position{positive} 2|6b64 14m38 X 2 excep2.adb 10i25 J{integer} 11r30 13r33 14r50 ... ======== excep2.ads pragma SPARK_Mode; package |excep2 is (line 5)-- procedure finds first occurence of char C before char Delim procedure exce|p (S : |String; C, D|eli|m : Character; Foun|d: out Boolean; (line10)Posi|tion : out Positive) with Annotate => (GNATprove, Intentional, "might not be initialized in", "reviewed by Leandro: If it can be used (Found=True), it is surely initialized"); end excep2; ======== excep2.adb pragma SPARK_Mode; package body excep2 is -- procedure finds first occurence of char C before char Delim (line 5)procedure excep (S : String; C, Delim : Character; Found: out Boolean; Position : out Positive) is begin Found := False; (line 10) for J in S'Range| loop if S(J) = Delim then return; elsif S(J) = C then Position := J; (line 15) Found := True; return; end if; end loop; return; (line 20)end excep; end excep2;