gnat.dg test: div_no_warning.adb

PARAT Didier didier.parat@fr.thalesgroup.com
Wed Feb 12 09:25:00 GMT 2014


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



More information about the Gcc mailing list