[Bug ada/47818] New: Pragma Assert is rejected with No_Implementation_Pragmas restriction.
eugen at debian dot org
gcc-bugzilla@gcc.gnu.org
Sat Feb 19 21:09:00 GMT 2011
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: unassigned@gcc.gnu.org
ReportedBy: eugen@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.
More information about the Gcc-bugs
mailing list