Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
14 src/sem.c
@@ -2165,7 +2165,11 @@ static bool sem_check_fcall(tree_t t)
return sem_check_conversion(t);
default:
{
- type_kind_t kind = type_kind(tree_type(decl));
+ type_t dtype = tree_type(decl);
+ while (type_kind(dtype) == T_SUBTYPE)
+ dtype = type_base(dtype);
+
+ type_kind_t kind = type_kind(dtype);
if (kind == T_CARRAY || kind == T_UARRAY) {
// The grammar is ambiguous between function calls and
// array references so must be an array reference
@@ -2792,8 +2796,11 @@ static bool sem_check_array_ref(tree_t t)
if (!sem_check(value))
return false;
+ type_t type = tree_type(tree_value(t));
+ while (type_kind(type) == T_SUBTYPE)
+ type = type_base(type);
+
unsigned nindex;
- type_t type = tree_type(value);
switch (type_kind(type)) {
case T_CARRAY:
nindex = type_dims(type);
@@ -2841,6 +2848,9 @@ static bool sem_check_array_slice(tree_t t)
return false;
type_t array_type = tree_type(tree_value(t));
+ while (type_kind(array_type) == T_SUBTYPE)
+ array_type = type_base(array_type);
+
type_kind_t array_k = type_kind(array_type);
if (array_k != T_CARRAY && array_k != T_UARRAY)
View
2  test/run_regr.rb
@@ -43,7 +43,7 @@ def run_cmd(c, invert=false)
pid = fork
exec("exec #{c} >>out 2>&1") if pid.nil?
begin
- timeout(Opts['v'] ? 10 : 3) do
+ timeout(Opts['v'] ? 10 : 5) do
Process.wait
fail unless $?.exitstatus == (invert ? 1 : 0)
end
View
23 test/sem/array.vhd
@@ -120,5 +120,26 @@ begin
y(1 to 3) := (others => 4); -- Error
assert y = (others => 4); -- Error
end process;
-
+
+ process is
+ subtype five_ints is ten_ints(1 to 4);
+ variable x : five_ints;
+ begin
+ x(1 to 3) := (1, 2, 3); -- OK
+ x(2) := 1; -- OK
+ x(3 downto 1) := (others => '0'); -- Error
+ assert x(2) = 5; -- OK
+ end process;
+
+ process is
+ function foo(size: integer) return int_array is
+ subtype rtype is int_array(size-1 downto 0);
+ variable result: rtype;
+ begin
+ assert result(0) = 1;
+ return result;
+ end;
+ begin
+ end process;
+
end architecture;
View
1  test/test_sem.c
@@ -496,6 +496,7 @@ START_TEST(test_array)
{ 119, "type of slice prefix is not an array" },
{ 120, "range direction of slice does not match prefix" },
{ 121, "others choice not allowed in this context" },
+ { 130, "range direction of slice does not match prefix" },
{ -1, NULL }
};
expect_errors(expect);

No commit comments for this range

Something went wrong with that request. Please try again.