public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gnat.dg test: div_no_warning.adb
@ 2014-02-12  9:25 PARAT Didier
  0 siblings, 0 replies; 2+ messages in thread
From: PARAT Didier @ 2014-02-12  9:25 UTC (permalink / raw)
  To: gcc

Hi,

I'm trying to use the tests in "gcc/testsuite/gnat.dg" and I'm having trouble understanding one particular test: "gnat.dg/div_no_warning.adb". If I understand correctly, this test is expected to compile without any error or warning. When I compile this test with a native compiler gnatmake, I get no error nor warning. But when I compile it with a gcc port to private target I get the following output:

div_no_warning.adb:13:20: warning: division by zero
div_no_warning.adb:13:20: warning: "Constraint_Error" will be raised at run time

The source looks like:
.
4  :    Flag : constant Boolean := False;
.
12:   if Flag and then F then
13:      Int := Int / 0;
14:   end if;
.

I checked the assembler produced by my compiler, it does not contain any code corresponding to the division or "if" code shown before. So I guess the compiler has detected that the "if False and then ." is dead code, but still I get the warnings.

I'm having a hard time finding what kind of option is activated/suppressed in the native compiler so it does not output those warnings.

I'm working on GCC 4.7.3 and GNAT 7.1.2.

Any help appreciated.

Thanks,
Didier

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: gnat.dg test: div_no_warning.adb
@ 2014-06-06 13:57 BELBACHIR Selim
  0 siblings, 0 replies; 2+ messages in thread
From: BELBACHIR Selim @ 2014-06-06 13:57 UTC (permalink / raw)
  To: BELBACHIR Selim, PARAT Didier; +Cc: gcc

Hi,

I've noticed that Constraint_error warning produced by gcc/testsuite/gnat.dg/div_no_warning.adb disappears if the target runtime contains :

"Configurable_Run_Time     : constant Boolean := False;"


* x86 native gnat contains Configurable_Run_Time := False ==> no warning
* Cross gnat port without full runtime contains Configurable_Run_Time := True  ==> warning raised


When I read the description of "Configurable_Run_Time_On_Target : Boolean := False;" in gcc/ada/targparm.ads (which may not be complete) I don't see any relation with this particular constraint error raising.

Can someone explain what are the full impact of Configurable_Run_Time boolean in system.ads and what is the relation between it and the "constant folding for short-circuit control forms" tested by gcc/testsuite/gnat.dg/div_no_warning.adb ?

    Regards,

Selim




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-06 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12  9:25 gnat.dg test: div_no_warning.adb PARAT Didier
2014-06-06 13:57 BELBACHIR Selim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).