Skip to content

nvc: ../src/lower.c:815: lower_wrap_element: Assertion `!type_const_bounds(type_elem(type))' failed. #1239

@jevogel

Description

@jevogel

The run fails with an assertion error when arr_t'element'length is encountered.

Example bug.vhd:

entity bug is
end entity bug;
architecture tb of bug is
  type arr_t is array(0 to 1) of bit_vector(1 downto 0);
begin
  process is
  begin
    report to_string(arr_t'element'length);
    wait;
  end process;
end architecture;

Running with nvc -a bug.vhd -e bug -r produces this stack trace:

nvc: ../src/lower.c:815: lower_wrap_element: Assertion `!type_const_bounds(type_elem(type))' failed.

*** Caught signal 6 (SIGABRT) ***

[0x6387f3d8aa49] ../src/util.c:906 signal_handler
[0x72b3d384532f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x72b3d389eb2c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:44 __pthread_kill_implementation
[0x72b3d389eb2c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:78 __pthread_kill_internal
[0x72b3d389eb2c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:89 pthread_kill@@GLIBC_2.34
[0x72b3d384527d] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../sysdeps/posix/raise.c:26 raise
[0x72b3d38288fe] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./stdlib/abort.c:79 abort
[0x72b3d382881a] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:96 __assert_fail_base.cold
[0x72b3d383b516] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:105 __assert_fail
[0x6387f3e04bfb] ../src/lower.c:815 lower_wrap_element.isra.0
[0x6387f3e0998b] ../src/lower.c:4864 lower_attr_ref
[0x6387f3e0998b] ../src/lower.c:5186 lower_expr
[0x6387f3e0b3bd] ../src/lower.c:12514 lower_rvalue
[0x6387f3e094c8] ../src/lower.c:4851 lower_attr_ref
[0x6387f3e094c8] ../src/lower.c:5186 lower_expr
[0x6387f3e0b3bd] ../src/lower.c:12514 lower_rvalue
[0x6387f3e1aa63] ../src/lower.c:1260 lower_subprogram_arg
[0x6387f3e1bd0d] ../src/lower.c:2417 lower_fcall
[0x6387f3e0858f] ../src/lower.c:5156 lower_expr
[0x6387f3e0b3bd] ../src/lower.c:12514 lower_rvalue
[0x6387f3e2103f] ../src/lower.c:5401 lower_report
[0x6387f3e2103f] ../src/lower.c:7275 lower_stmt
[0x6387f3e2496b] ../src/lower.c:6268 lower_sequence
[0x6387f3e2496b] ../src/lower.c:11020 lower_process
[0x6387f3de61d6] ../src/elab.c:2145 elab_stmts
[0x6387f3de8fec] ../src/elab.c:1634 elab_architecture
[0x6387f3eba150] ../src/rt/model.c:3796 call_with_model
[0x6387f3de96e9] ../src/elab.c:2404 elab
[0x6387f3d83b9f] ../src/nvc.c:553 elaborate
[0x6387f3d83b9f] ../src/nvc.c:2443 process_command
[0x6387f3d83a1f] ../src/nvc.c:2001 cover_report_cmd
[0x6387f3d83a1f] ../src/nvc.c:2471 process_command
[0x6387f3d8099b] ../src/nvc.c:2607 main

Reporting a different attribute of arr_t'element like arr_t'element'ascending produces no error. Creating a nested array like type arr2_t is array(0 to 1) of arr_t and referencing arr2_t'element'element'length also produces the error.

Using git bisect, I determined that the last good commit (issue not present) was 238d36a and the first bad commit (issue present) was 06b289f.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions