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,51b019c4f21867e3 X-Google-Attributes: gid103376,domainid0,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!feeder.news-service.com!newsfeed0.kamp.net!newsfeed.kamp.net!eweka.nl!hq-usenetpeers.eweka.nl!69.16.177.246.MISMATCH!cyclone03.ams!news.ams.newshosting.com!npeersf01.ams!newsfet15.ams.POSTED!40385e62!not-for-mail From: Per Sandberg User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Compiler bug References: <95883266-bd95-499f-a2dc-59580f2c5089@2g2000hsn.googlegroups.com> In-Reply-To: <95883266-bd95-499f-a2dc-59580f2c5089@2g2000hsn.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <1CPIj.2$sT1.0@newsfet15.ams> X-Complaints-To: abuse@WWWSpace.NET NNTP-Posting-Date: Wed, 02 Apr 2008 13:44:29 EDT Date: Wed, 02 Apr 2008 19:44:49 +0200 Xref: g2news1.google.com comp.lang.ada:20759 Date: 2008-04-02T19:44:49+02:00 List-Id: Well it was still in AdaCore:s compiler yesterday so I took the liberty to report it since people at my company is using the Ada2005 features in GNAT and I want to be proactive. /Per Maciej Sobczak wrote: > Consider a trivial example with composition of interfaces: > > with Ada.Text_IO; > > procedure A is > > package Stuff is > > type Base_1 is interface; > procedure P_1 (X : in Base_1) is abstract; > > type Base_2 is interface; > procedure P_2 (X : in Base_2) is abstract; > > type Middle is interface and Base_1 and Base_2; > > type Concrete is new Middle with null record; > procedure P_1 (X : in Concrete); > procedure P_2 (X : in Concrete); > > function Make_Concrete return Concrete; > > end Stuff; > > package body Stuff is > > procedure P_1 (X : in Concrete) is > begin > Ada.Text_IO.Put_Line ("Concrete.P_1"); > end P_1; > > procedure P_2 (X : in Concrete) is > begin > Ada.Text_IO.Put_Line ("Concrete.P_2"); > end P_2; > > function Make_Concrete return Concrete is > C : Concrete; > begin > return C; > end Make_Concrete; > > end Stuff; > > use Stuff; > > B_1 : Base_1'Class := Make_Concrete; > B_2 : Base_2'Class := Make_Concrete; > > begin > B_1.P_1; > B_2.P_2; > end; > > $ gnatmake a > $ ./a > Concrete.P_1 > Concrete.P_1 > $ > > In other words, both calls dispatched to the same procedure. > > Some experiments led me to the interesting observation: > Changing this: > > type Middle is interface and Base_1 and Base_2; > > to this: > > type Middle is interface and Base_2 and Base_1; > > results in: > > $ ./a > Concrete.P_2 > Concrete.P_2 > > Again, both calls dispatched to the same procedure, but now I know > that in both cases the dispatch goes to the *first* progenitor of the > Middle interface. Obviously against 3.9.4-1/b. > > Things get particularly funny when the signatures of P_1 and P_2 are > different (say, they have different sets of parameters). > > It all looks like the v-table got messed up. > > $ gnatmake --version > GNATMAKE 4.4.0 20080314 (experimental) [trunk revision 133226] > > It is the newest version I could find for my system. > > -- > Maciej Sobczak * www.msobczak.com * www.inspirel.com