From 0675877ad4ff04d1273d133b8cd4b2c64b0671ca Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 14 Mar 2024 19:56:57 +0000 Subject: [PATCH] Skip over record element constraints when building VHPI model Issue #866 --- src/vhpi/vhpi-model.c | 19 ++++++++++++++----- test/regress/vhpi11.vhd | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/vhpi/vhpi-model.c b/src/vhpi/vhpi-model.c index f74f55be..0b70f6e7 100644 --- a/src/vhpi/vhpi-model.c +++ b/src/vhpi/vhpi-model.c @@ -3326,11 +3326,20 @@ static c_typeDecl *build_typeDecl(type_t type, c_vhpiObject *obj) assert(nconstrs == 1); tree_t c = type_constraint(type, 0); - if (tree_subkind(c) != C_RANGE) - fatal_trace("unsupported constraint subkind %d", tree_subkind(c)); - - c_intRange *ir = build_int_range(tree_range(c, 0), NULL, 0, NULL); - APUSH(td->Constraints, &(ir->range.object)); + switch (tree_subkind(c)) { + case C_RANGE: + { + tree_t r = tree_range(c, 0); + c_intRange *ir = build_int_range(r, NULL, 0, NULL); + APUSH(td->Constraints, &(ir->range.object)); + } + break; + case C_RECORD: + // TODO: how to represent this in VHPI? + break; + default: + fatal_at(tree_loc(c), "unsupported constraint subkind"); + } } return &(td->typeDecl); diff --git a/test/regress/vhpi11.vhd b/test/regress/vhpi11.vhd index d9ee6d08..538037b1 100644 --- a/test/regress/vhpi11.vhd +++ b/test/regress/vhpi11.vhd @@ -15,5 +15,6 @@ entity vhpi11 is end entity; architecture test of vhpi11 is + signal s : t_rec(y(1 to 3)); -- See issue #866 begin end architecture; -- 2.39.2