comp.lang.ada
 help / color / mirror / Atom feed
From: rrr.eee.27@gmail.com
Subject: Re: gnat compiler issues with a partial build
Date: Thu, 11 Jun 2015 09:10:28 -0700 (PDT)
Date: 2015-06-11T09:10:28-07:00	[thread overview]
Message-ID: <15483248-927d-4f25-a399-1a722e60a9b2@googlegroups.com> (raw)
In-Reply-To: <6d5f352b-d886-4cd4-8f88-4116fe34129a@googlegroups.com>

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 kernel module last night for the first time.
> 
> But I think I found a subtle problem in the compiler (gnat-gcc 4.7.4) while doing my Linux kernel module.
> 

> -------------------------------------
> 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
> -------------------------------------
> 
> 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 with exception propagation I suspect, from looking at a disassembly.

> The bottom line is that, no-matter what I all switch off, the compiler sometimes emits random subroutine calls in its error detection section. Normally they don't bite you, because you would almost never hit them in a well constructed program. But a kernel module with those simply will not load; end.
> 
> The only vague reference to such a scenario might be in the "-gnatp" description in the gnat_ug.
> 
> So if any of the compiler theologians has any light on this: please feel welcome to comment.


The symbol shown (__gnat_rcheck_CE_*) is generated for language required run time checks. Here it is an access check. They typically are range checks.

These checks are generated if you don't suppress them via -gnatp regardless of the capabilities of the RTS. Your coding style and the compiler switches must match the RTS capabilities. You don't suppress the run time checks by a pragma Restriction only, you also have to set the command line option -gnatp.

In another post you said that you don't wanted to use -gnatp as that would be like coding in C. That is not my experience at all!  The compiler still does a fantastic job at compile time to ensure range and access properties. Gnat found quite some subtle errors in my code even with checks suppressed (-gnatp).

RE

  parent reply	other threads:[~2015-06-11 16:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 11:12 gnat compiler issues with a partial build jan.de.kruyf
2015-06-04 19:03 ` Lucretia
2015-06-09  8:11   ` jan.de.kruyf
2015-06-09 10:21 ` Mark Lorenzen
2015-06-09 11:28   ` jan.de.kruyf
2015-06-09 13:03     ` Mark Lorenzen
2015-06-09 18:57       ` jan.de.kruyf
2015-06-10 10:11         ` Mark Lorenzen
2015-06-10 15:34           ` jan.de.kruyf
2015-06-10 16:59             ` Simon Wright
2015-06-10 17:01               ` Simon Wright
2015-06-10 20:36                 ` jan.de.kruyf
2015-06-11  5:01                   ` Simon Wright
2015-06-11 14:08                     ` jan.de.kruyf
2015-06-11 16:10 ` rrr.eee.27 [this message]
2015-06-11 19:38   ` Simon Wright
2015-06-12 14:37     ` jan.de.kruyf
2015-06-12 15:05       ` Simon Wright
2015-06-12 15:12         ` jan.de.kruyf
2015-06-12 15:31   ` jan.de.kruyf
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox