http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47818

           Summary: Pragma Assert is rejected with
                    No_Implementation_Pragmas restriction.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: eu...@debian.org


Created attachment 23408
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23408
Patch for the bug

Compilation of code containing pragma Assert fails if restriction
No_Implementation_Pragmas is used, even with -gnat2005 or -gnat2012 flags:

% cat test.adb                                                                  
pragma Restrictions(No_Implementation_Pragmas);

procedure test(I : Integer) is
begin
  pragma Assert(I /= 1);
  null;
end;
% gcc -c test.adb -gnat2005                                                     
test.adb:5:03: violation of restriction "no_implementation_pragmas" at line 1

Source file gcc/ada/sem_prag.adb contains correct check for Pragma_Assert
(Ada_2005_Pragma). But this pragma is then rewritten as pragma Check and
restrictions (GNAT_Pragma) are tested again. This test fails and causes
compilation error.

Attached patch adds check in Pragma_Check case. If rewritten pragma Assert was
found then restrictions are not checked.

Reply via email to