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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b0a828f417615ded X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!aioe.org!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Compiler Bug Date: Wed, 05 Dec 2007 22:51:39 -0800 Organization: None to speak of Message-ID: <87hciwxqmc.fsf@kvetch.smov.org> References: <9f4bc0eb-d44a-43f9-83bd-dd07fa8538f2@i12g2000prf.googlegroups.com> <8a6283ea-be44-46d7-a2f1-a6d626266b58@p69g2000hsa.googlegroups.com> <97d0825d-ee08-45ef-b736-ca005caf1a81@e23g2000prf.googlegroups.com> NNTP-Posting-Host: aVIvKdUSjN4PsAbmZ6BGcQ.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@aioe.org Cancel-Lock: sha1:1VZJkK0BxWyrG7pam0aLe0FcZe0= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Xref: g2news1.google.com comp.lang.ada:18739 Date: 2007-12-05T22:51:39-08:00 List-Id: REH writes: > On Dec 4, 5:25 pm, Lucretia wrote: >> On Dec 4, 9:58 pm, REH wrote: >> >> > I have an issue that my compiler vendor is trying to tell me is not a >> > bug. I have two functions. They both have a local variable of the >> > same name. One calls the other (which is inlined). The compiler >> > treats the variable in the caller as if it is of the same type as the >> > one in the callee. Because of this, we get a constraint_error >> > exception. The problem goes away when the pragma inline is removed. >> > The vendor is trying to tell me that this behavior is acceptable and >> > correct. I do not believe that it is. Please tell me who it right. >> >> Which compiler? Have you tried it in GNAT? >> >> Can you post the code? > > No, I can't, sorry. But the gist of it is: > > function F1 return T1; > pragma Inline(F1); > > function F1 return T1 is > R : T1; > begin > -- do stuff > return R; > end F1; > > function F2 return T2 is > V : T1 := F1; > R : T2; > begin > -- do stuff > return R; > end F2; > > The compiler and debugger treat the R in F2 as if it is of type T1, > not T2. Exceeding the bounds of T1 cause F2 to raise a > constraint_error. The problem goes away if the pragma inline is > removed. If you can't post your original code for whatever reason (because it's proprietary, or because it's too big, or whatever), can you construct a small example that exhibits the same symptom? Perhaps taking your "gist of it" code above and adding definitions for T1 and T2 and some output statements would do it. Others here could try based on what you've posted, but without knowing what compiler you're using they'd have no way of knowing if they've reproduced the problem. -- Keith Thompson (The_Other_Keith) Looking for software development work in the San Diego area. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"