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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.42.92.8 with SMTP id r8mr19756176icm.31.1434123113740; Fri, 12 Jun 2015 08:31:53 -0700 (PDT) X-Received: by 10.140.21.197 with SMTP id 63mr230562qgl.31.1434123113612; Fri, 12 Jun 2015 08:31:53 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h15no2198712igd.0!news-out.google.com!4ni1115qgh.1!nntp.google.com!z60no840575qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 12 Jun 2015 08:31:53 -0700 (PDT) In-Reply-To: <15483248-927d-4f25-a399-1a722e60a9b2@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=105.210.1.171; posting-account=orbgeAkAAADzWCTlruxuX_Ts4lIq8C5J NNTP-Posting-Host: 105.210.1.171 References: <6d5f352b-d886-4cd4-8f88-4116fe34129a@googlegroups.com> <15483248-927d-4f25-a399-1a722e60a9b2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: gnat compiler issues with a partial build From: jan.de.kruyf@gmail.com Injection-Date: Fri, 12 Jun 2015 15:31:53 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:26282 Date: 2015-06-12T08:31:53-07:00 List-Id: On Thursday, June 11, 2015 at 6:10:30 PM UTC+2, rrr.e...@gmail.com wrote: > On Thursday, June 4, 2015 at 1:12:27 PM UTC+2, jan.de...@gmail.com wrote: > > First the good news: I was able to load and unload a mixed C and Ada ke= rnel module last night for the first time. > >=20 > > But I think I found a subtle problem in the compiler (gnat-gcc 4.7.4) w= hile doing my Linux kernel module. > >=20 >=20 > > ------------------------------------- > > jan@janDell:~/MMS/programs-KERNEL/ec-master/obj$ nm memory_copy.o > > U __gnat_rcheck_CE_Access_Check > > 0000000000000000 T memcpy > > 0000000000000000 D memory_copy_E > > ------------------------------------- > >=20 > > They are all related to the Exception machinery and refer to about 4 or= 5 symbols in "Ada.Exeptions" in the standard "x86 Linux" runtime. > > They are caused by any construct where the compiler suspects that there= might be a runtime error under certain conditions. And they have to do wit= h exception propagation I suspect, from looking at a disassembly. >=20 > > The bottom line is that, no-matter what I all switch off, the compiler = sometimes emits random subroutine calls in its error detection section. Nor= mally they don't bite you, because you would almost never hit them in a wel= l constructed program. But a kernel module with those simply will not load;= end. > >=20 > > The only vague reference to such a scenario might be in the "-gnatp" de= scription in the gnat_ug. > >=20 > > So if any of the compiler theologians has any light on this: please fee= l welcome to comment. >=20 >=20 > The symbol shown (__gnat_rcheck_CE_*) is generated for language required = run time checks. Here it is an access check. They typically are range check= s. >=20 So I found out when I read the sources of the native RTS > In another post you said that you don't wanted to use -gnatp as that woul= d be > like coding in C. That is not my experience at all! =20 It is a very good compiler, but per definition the compiler cannot catch ru= ntime errors (like passing an out of bounds index to an array write routine= for instance). This is why some people like runtime checking, to catch their own stupiditi= es I suppose. C never had it, and it is the one big issue people have with it, except for= the baroque syntax.=20 Of course excellent software is also written in C, people learn to compensa= te for deficiencies. And Gcc has improved by leaps and bounds, also the C c= ompiler part.=20 But I suppose lazy people like me, like some language like Ada that does do= runtime checking. The delays caused by it are very small compared to other= issues that some languages (and compilers) have.=20 So what I have done in the past when I really did not want runtime checking= is first compile it in, and check where gnat puts them, and then put some = form of 'assert' or 'if then' and / or review the code to see why gnat puts= them. cheers, j.