URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 304 |
Rev 384 |
-- { dg-do compile }
|
-- { dg-do compile }
|
package body Old_Errors is
|
package body Old_Errors is
|
|
|
A : Integer;
|
A : Integer;
|
|
|
function F
|
function F
|
(X : Integer := A'Old) -- { dg-error "can only appear within subprogram" }
|
(X : Integer := A'Old) -- { dg-error "can only appear within subprogram" }
|
return Integer is
|
return Integer is
|
begin
|
begin
|
return X;
|
return X;
|
end F;
|
end F;
|
|
|
procedure P (I : in Integer; O : out Integer; IO : in out Integer) is
|
procedure P (I : in Integer; O : out Integer; IO : in out Integer) is
|
Y : Integer := 0;
|
Y : Integer := 0;
|
function G
|
function G
|
(X : Integer := Y'Old) -- { dg-error "cannot refer to local variable" }
|
(X : Integer := Y'Old) -- { dg-error "cannot refer to local variable" }
|
return Integer is
|
return Integer is
|
begin
|
begin
|
return X;
|
return X;
|
end G;
|
end G;
|
|
|
function H (X : Integer := A'Old) return Integer is -- OK
|
function H (X : Integer := A'Old) return Integer is -- OK
|
begin
|
begin
|
return X;
|
return X;
|
end H;
|
end H;
|
|
|
begin
|
begin
|
Y := Y'Old; -- { dg-error "cannot refer to local variable" }
|
Y := Y'Old; -- { dg-error "cannot refer to local variable" }
|
declare
|
declare
|
Z : Integer := 0;
|
Z : Integer := 0;
|
procedure Inner is
|
procedure Inner is
|
IL : Integer := 0;
|
IL : Integer := 0;
|
begin
|
begin
|
IL := IL'Old; -- { dg-error "cannot refer to local variable" }
|
IL := IL'Old; -- { dg-error "cannot refer to local variable" }
|
Z := Z'Old; -- OK
|
Z := Z'Old; -- OK
|
end Inner;
|
end Inner;
|
begin
|
begin
|
Y := Z'Old; -- { dg-error "cannot refer to local variable" }
|
Y := Z'Old; -- { dg-error "cannot refer to local variable" }
|
end;
|
end;
|
Y := I'Old; -- { dg-warning "Old applied to constant has no effect" }
|
Y := I'Old; -- { dg-warning "Old applied to constant has no effect" }
|
Y := O'Old; -- OK
|
Y := O'Old; -- OK
|
Y := IO'Old; -- OK
|
Y := IO'Old; -- OK
|
Y := G; -- OK, error has been signalled at G declaration
|
Y := G; -- OK, error has been signalled at G declaration
|
pragma Assert (G (3)'Old = Y); -- { dg-error "cannot refer to local variable" }
|
pragma Assert (G (3)'Old = Y); -- { dg-error "cannot refer to local variable" }
|
end P;
|
end P;
|
|
|
end Old_Errors;
|
end Old_Errors;
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.