Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzz testing #1038

Open
avelure opened this issue Oct 25, 2024 · 16 comments
Open

Fuzz testing #1038

avelure opened this issue Oct 25, 2024 · 16 comments

Comments

@avelure
Copy link

avelure commented Oct 25, 2024

I ran the fuzzing for a week and collected 32 crashing cases.
crashes_cmin.zip
There might be some duplicates in here as there often is different code paths that lead to the same crash.
The log below shows SIGABRT, but you can ignore this as this is because it is neceseary to modify the source to raise a signal to the fuzzer when something interesting occurs. You can see my patch here: https://github.com/avelure/vhdl_fuzz/blob/main/nvc_bug_abort.patch

# find . -maxdepth 1 -type f -exec echo "file: {}" \; -exec /usr/local/bin/nvc --std=08 --ignore-time -a --relaxed --error-limit=1 --psl {} \;
file: ./12dc86da02baf50abcdb2d9777c5ff7f6ef12056c14535fd30c1ad9e50f71411
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x555555627498] /nvc/build/../src/parse.c:7265 p_variable_declaration
          tree_add_decl(parent, t);
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x5555556220ba] /nvc/build/../src/parse.c:12936 p_package_body_declarative_item
       case tSHARED:
-->       p_variable_declaration(parent);
          break;
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x555555622239] /nvc/build/../src/parse.c:12987 p_package_body_declarative_item
             require_std(STD_08, "nested package declarations");
-->          tree_add_decl(parent, p_package_body(NULL));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./1725b8e09f4abd33a4be1451e6b69e2f56112371ad021eeffd3deb4e2334def1
nvc: ../src/type.c:164: _Bool _type_eq(type_t, type_t, _Bool, hash_t *): Assertion `a != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x5555556af12c] /nvc/build/../src/type.c:164 _type_eq
    {
-->    assert(a != NULL);
       assert(b != NULL);
[0x555555812e5a] ../src/type.c:264 make_visible
[0x555555630e08] make_visible_slow
[0x555555630e08] insert_name
[0x555555630e08] ../src/names.c:7439 p_alias_declaration
[0x555555637072] p_package_declarative_item
[0x555555637072] p_package_declarative_part
[0x555555637072] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./181a6c3f1ee6985b3b3d3f5b38b8d6f81f5c826a761045cb7740b8d93a753314
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555668d42] /nvc/build/../src/parse.c:4417 p_element_association
       if (head == NULL && peek() != tOTHERS)
-->       head = p_expression();
[0x55555565028a] ../src/tree.c:0 p_aggregate_or_expression
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555668d42] /nvc/build/../src/parse.c:4417 p_element_association
       if (head == NULL && peek() != tOTHERS)
-->       head = p_expression();
[0x55555565028a] ../src/tree.c:0 p_aggregate_or_expression
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555650149] /nvc/build/../src/parse.c:4476 p_aggregate_or_expression
-->    tree_t head = p_expression();
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555674bf4] p_expression
[0x555555674bf4] /nvc/build/../src/parse.c:5016 p_interface_constant_declaration
       if (optional(tWALRUS)) {
-->       init = p_expression();
          solve_types(nametab, init, type);
[0x55555567053d] /nvc/build/../src/parse.c:0 p_interface_declaration
[0x55555566f88a] p_interface_element
[0x55555566f88a] /nvc/build/../src/parse.c:5844 p_interface_list
-->    p_interface_element(parent, kind, ordered);
[0x555555678ec0] /nvc/build/../src/parse.c:5507 p_formal_parameter_list
-->    p_interface_list(decl, T_PARAM_DECL, standard() >= STD_19);
[0x555555624d43] /nvc/build/../src/parse.c:7107 p_subprogram_specification
       if (has_param_list) {
-->       p_formal_parameter_list(t, type);
          consume(tRPAREN);
[0x55555561b248] /nvc/build/../src/parse.c:9449 p_block_declarative_item
          else {
-->          tree_t spec = p_subprogram_specification();
             if (peek() == tSEMI)
[0x555555618d80] p_architecture_declarative_part
[0x555555618d80] p_architecture_body
[0x555555618d80] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./209648284096242ef8e489ec9a8c9878d32f790438edcca953a49bd7bf7ad8f4
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555664bd8] p_actual_part
[0x555555664bd8] /nvc/build/../src/parse.c:3257 p_association_element
-->    tree_t value = p_actual_part(class, kind);
[0x55555568e001] p_association_list
[0x55555568e001] /nvc/build/../src/parse.c:8891 p_port_map_aspect
-->    p_association_list(inst, unit, F_PORT_MAP);
[0x55555568af5f] /nvc/build/../src/parse.c:10655 p_component_instantiation_statement
       if (peek() == tPORT)
-->       p_port_map_aspect(t, entity);
[0x55555561c695] p_concurrent_statement
[0x55555561c695] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./237dc1fae4aa4449167b52e5af0094718eba6de3b79c3676c1f186fd0589cc85
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x5555558262cd] /nvc/build/../src/names.c:1038 insert_generics
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x555555636d58] p_package_header
[0x555555636d58] /nvc/build/../src/parse.c:8818 p_package_declaration
       if (standard() >= STD_08)
-->       p_package_header(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./291f781a7966d1fd9f6d08d2319d1607c2e8eb00bfddfd1934373b86c504926e
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x5555558262cd] /nvc/build/../src/names.c:1038 insert_generics
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x555555636d58] p_package_header
[0x555555636d58] /nvc/build/../src/parse.c:8818 p_package_declaration
       if (standard() >= STD_08)
-->       p_package_header(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./2b65ad2cdb69369c35d7d777fd176d371435d69906e9636fcb1799c756dc834e
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x55555562f4f9] /nvc/build/../src/parse.c:6946 p_constant_declaration
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x555555636e68] p_package_declarative_item
[0x555555636e68] p_package_declarative_part
[0x555555636e68] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./3d6eaf8db2d6639e23ef48375bf8637db2916b4fa93f1da0af569e929e0ec2a4
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x5555556759b4] p_expression
[0x5555556759b4] /nvc/build/../src/parse.c:5132 p_interface_signal_declaration
          if (optional(tWALRUS)) {
-->          init = p_expression();
             solve_types(nametab, init, type);
[0x55555566fb8f] /nvc/build/../src/parse.c:5810 p_interface_declaration
          if (kind == T_PORT_DECL)
-->          p_interface_signal_declaration(parent, kind, ordered);
          else
[0x55555566f953] p_interface_element
[0x55555566f953] /nvc/build/../src/parse.c:5851 p_interface_list
          }
-->       p_interface_element(parent, kind, ordered);
       }
[0x55555568de86] p_port_list
[0x55555568de86] /nvc/build/../src/parse.c:5876 p_port_clause
-->    p_port_list(parent);
[0x555555616cf0] p_entity_header
[0x555555616cf0] p_entity_declaration
[0x555555616cf0] /nvc/build/../src/parse.c:9383 p_primary_unit
       case tENTITY:
-->       p_entity_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./3f3d061108d3a7abc82e067554883df795dbce17ade7348fee15e17524275f5b
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564ea23] /nvc/build/../src/parse.c:1500 p_relation
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555565f0b4] /nvc/build/../src/parse.c:4366 p_choice
       else {
-->       tree_t name = head ?: p_expression();
          const tree_kind_t name_kind = tree_kind(name);
[0x55555565932c] p_choices
[0x55555565932c] p_case_statement_alternative
[0x55555565932c] p_case_statement
[0x55555565932c] /nvc/build/../src/parse.c:10504 p_sequential_statement
       case tCASE:
-->       return p_case_statement(label);
[0x55555562693f] p_sequence_of_statements
[0x55555562693f] /nvc/build/../src/parse.c:8287 p_subprogram_body
-->    p_sequence_of_statements(spec);
[0x55555561b2a6] /nvc/build/../src/parse.c:9453 p_block_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555618d80] p_architecture_declarative_part
[0x555555618d80] p_architecture_body
[0x555555618d80] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./40a5c50caef74d633f7831cfc4451f713e7ba9f6616d70434e0d1e1f52de0209
nvc: ../src/type.c:111: tree_t tree_array_nth(item_t *, unsigned int): Assertion `(n) < (item->obj_array)->count' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x555555739eca] tree_array_nth
[0x555555739eca] type_enum_literal
[0x555555739eca] ../src/type.c:209 get_enum_lit
[0x5555557447c4] /nvc/build/../src/common.c:2043 subtype_for_string
       if (is_enum)
-->       right = get_enum_lit(str, index_type, iright);
       else
[0x55555582ee19] /nvc/build/../src/names.c:3782 try_solve_string
-->    type_t sub = subtype_for_string(str, type);
       tree_set_type(str, sub);
[0x555555829069] solve_string
[0x555555829069] /nvc/build/../src/names.c:4866 _solve_types
       case T_STRING:
-->       return solve_string(tab, expr);
       case T_REF:
[0x55555582880a] /nvc/build/../src/names.c:4918 solve_types
       type_set_add(tab, constraint, NULL);
-->    type_t type = _solve_types(tab, expr);
       type_set_pop(tab);
[0x55555562f315] /nvc/build/../src/parse.c:6929 p_constant_declaration
          if (standard() < STD_19 || type_is_unconstrained(type))
-->          solve_types(nametab, init, type);
          else
[0x55555561ac32] /nvc/build/../src/parse.c:9439 p_block_declarative_item
       case tCONSTANT:
-->       p_constant_declaration(parent);
          break;
[0x555555618d80] p_architecture_declarative_part
[0x555555618d80] p_architecture_body
[0x555555618d80] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./47354825eb49e9636e5c14b41152066c063dfb46c47ece41b84eceaef6ebcb87
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555668d42] /nvc/build/../src/parse.c:4417 p_element_association
       if (head == NULL && peek() != tOTHERS)
-->       head = p_expression();
[0x555555661408] /nvc/build/../src/parse.c:4456 p_aggregate
       do {
-->       p_element_association(t, NULL);
       } while (optional(tCOMMA));
[0x5555556569d0] /nvc/build/../src/parse.c:10526 p_sequential_statement
          {
-->          tree_t agg = p_aggregate();
[0x55555565853e] p_sequence_of_statements
[0x55555565853e] p_loop_statement
[0x55555565853e] /nvc/build/../src/parse.c:10509 p_sequential_statement
       case tFOR:
-->       return p_loop_statement(label);
[0x55555562693f] p_sequence_of_statements
[0x55555562693f] /nvc/build/../src/parse.c:8287 p_subprogram_body
-->    p_sequence_of_statements(spec);
[0x55555562213f] /nvc/build/../src/parse.c:12931 p_package_body_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./4788c6e651f9bdbb83fccfa6b861cea794f91ca18db53483e637342df4f2d5d8
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c4e2] /nvc/build/../src/parse.c:1500 p_expression_with_head
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x555555664bd8] p_actual_part
[0x555555664bd8] /nvc/build/../src/parse.c:3257 p_association_element
-->    tree_t value = p_actual_part(class, kind);
[0x5555556390a1] p_association_list
[0x5555556390a1] /nvc/build/../src/parse.c:8906 p_generic_map_aspect
-->    p_association_list(inst, unit, F_GENERIC_MAP);
[0x55555568af07] /nvc/build/../src/parse.c:10652 p_component_instantiation_statement
       if (peek() == tGENERIC)
-->       p_generic_map_aspect(t, entity);
[0x55555561c695] p_concurrent_statement
[0x55555561c695] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./4e16949ec326542a03cb8ee829bf5203566412f9579e4450ebf336010a8a64a5
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555567a779] /nvc/build/../src/parse.c:6817 p_conditional_expression
-->    tree_t expr0 = p_expression();
[0x5555556271e9] /nvc/build/../src/parse.c:7246 p_variable_declaration
       if (optional(tWALRUS)) {
-->       init = p_conditional_expression();
          solve_types(nametab, init, type);
[0x5555556264bf] p_subprogram_declarative_item
[0x5555556264bf] p_subprogram_declarative_part
[0x5555556264bf] /nvc/build/../src/parse.c:8283 p_subprogram_body
-->    p_subprogram_declarative_part(spec);
[0x55555562213f] /nvc/build/../src/parse.c:12931 p_package_body_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./5167d85a877bda6ab1f16c5bdaabd10d0770f1fdffce7e8ea975c936ef622fc9
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x55555562f4f9] /nvc/build/../src/parse.c:6946 p_constant_declaration
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x555555636e68] p_package_declarative_item
[0x555555636e68] p_package_declarative_part
[0x555555636e68] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555622357] /nvc/build/../src/parse.c:12991 p_package_body_declarative_item
             require_std(STD_08, "nested package declarations");
-->          tree_add_decl(parent, p_package_declaration(NULL));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./51fa4f1f438bd4398b99ad3f713af0426f7c83c68efc109d6970d0e465dd78ac
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x5555558262cd] /nvc/build/../src/names.c:1038 insert_generics
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x555555636d58] p_package_header
[0x555555636d58] /nvc/build/../src/parse.c:8818 p_package_declaration
       if (standard() >= STD_08)
-->       p_package_header(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./52c07ae78c40db41f4206f42bda1a2d7ff7e49219e3cd3e9753bd0f7c431860f
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x55555562f4f9] /nvc/build/../src/parse.c:6946 p_constant_declaration
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x555555636e68] p_package_declarative_item
[0x555555636e68] p_package_declarative_part
[0x555555636e68] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./5f97485ea9e89ad928bdf5fffb747446d7d91688ebbe112bce0caa63c9dda2c6
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fcd8] /nvc/build/../src/parse.c:1500 p_simple_expression
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c4e2] /nvc/build/../src/parse.c:1500 p_expression_with_head
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x555555650149] /nvc/build/../src/parse.c:4476 p_aggregate_or_expression
-->    tree_t head = p_expression();
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564eec0] p_unary_expression
[0x55555564eec0] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555565dadd] p_condition
[0x55555565dadd] /nvc/build/../src/parse.c:6971 p_assertion
-->    tree_set_value(s, p_condition());
[0x555555656f57] p_assertion_statement
[0x555555656f57] /nvc/build/../src/parse.c:10489 p_sequential_statement
       case tASSERT:
-->       return p_assertion_statement(label);
[0x555555689c2e] p_sequence_of_statements
[0x555555689c2e] p_process_statement_part
[0x555555689c2e] /nvc/build/../src/parse.c:8483 p_process_statement
-->    p_process_statement_part(t);
[0x55555561d2ff] p_concurrent_statement
[0x55555561d2ff] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./60bc12eff12e4f7e41dc5499ffb25c74da54d4f78c77d1200d3621e7a8d6ca30
nvc: ../src/common.c:1602: unsigned int get_case_choice_char(tree_t, int): Assertion `tree_kind(decl) == T_CONST_DECL || tree_kind(decl) == T_ALIAS' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x5555557412af] /nvc/build/../src/common.c:1602 get_case_choice_char
             tree_t decl = tree_ref(value);
-->          assert(tree_kind(decl) == T_CONST_DECL || tree_kind(decl) == T_ALIAS);
             assert(tree_has_value(decl));
[0x55555575c562] ../src/common.c:1657 bounds_check_array_case
[0x555555754c87] bounds_check_case
[0x555555754c87] /nvc/build/../src/bounds.c:1412 bounds_visit_fn
       case T_CASE:
-->       bounds_check_case(t);
          break;
[0x555555765051] /nvc/build/../src/object.c:715 object_rewrite
       for (;;) {
-->       object_t *new = (*ctx->post_fn[object->tag])(object, ctx->context);
          if (new == object || (object = object_rewrite(new, ctx)) == NULL)
[0x555555764dfd] /nvc/build/../src/object.c:790 object_rewrite
                      object_t *o = object->items[n].obj_array->items[i];
-->                   if ((o = object_rewrite(o, ctx))) {
                         object_write_barrier(object, o);
[0x555555764dfd] /nvc/build/../src/object.c:790 object_rewrite
                      object_t *o = object->items[n].obj_array->items[i];
-->                   if ((o = object_rewrite(o, ctx))) {
                         object_write_barrier(object, o);
[0x5555556ada40] /nvc/build/../src/tree.c:1310 tree_rewrite
-->    object_t *result = object_rewrite(&(t->object), &ctx);
       free(ctx.cache);
[0x55555574960c] ../src/bounds.c:1447 analyse_file
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./725310712b02f458c257a89910b594f20804b03730f0984a88b89b23df2f2311
nvc: ../src/sem.c:3795: _Bool sem_check_array_aggregate(tree_t, nametab_t *): Assertion `akind == A_CONCAT || akind == A_SLICE' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x5555556cbe2c] sem_check_array_aggregate
[0x5555556cbe2c] /nvc/build/../src/sem.c:3996 sem_check_aggregate
       if (type_is_array(composite_type))
-->       return sem_check_array_aggregate(t, tab);
       else
[0x5555556d0766] /nvc/build/../src/sem.c:2936 sem_check_cond_assign
-->    if (!sem_check(target, tab))
          return false;
[0x55555568c491] /nvc/build/../src/parse.c:10874 p_concurrent_signal_assignment_statement
       if (label) insert_name(nametab, t, NULL);
-->    sem_check(t, nametab);
       return t;
[0x55555561c2ec] p_concurrent_statement
[0x55555561c2ec] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6

Second part of log comes in a new comment as there is a comment length limit.

There was also one that causes an input buffer overflow, can't enlarge buffer because scanner uses REJECT, but that might not be so interesting.
input_buffer_overflow.zip

Then there were 5 cases that seem to hang the parser or the parser takes an abnormal long time to complete.
hangs.zip

Currently I'm just using the analyze switch for fuzzing which is a bit slow. I guess I could use the --syntax switch to parse the file, but it is missing some of the analysis switches like --psl, --relaxed and --error-limit, though it seems quite easy to add, so maybe I can make a pullrequest.
Another option is to use persistence mode to loop the parser and just change the input buffer to speed up the testing https://github.com/AFLplusplus/AFLplusplus/blob/stable/instrumentation/README.persistent_mode.md
this also seems feasible in nvc, so I can look at this next.

@avelure
Copy link
Author

avelure commented Oct 25, 2024

Second part of log:

file: ./7c96d591351ae9d499df39a80e42815cb94e68692fd17fac9e52bb9001ed70ed
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555564e270] /nvc/build/../src/parse.c:0 p_range
[0x55555566d97f] /nvc/build/../src/parse.c:2958 p_range_constraint
          {
-->          tree_t r = p_range(expr1);
             solve_types(nametab, r, constraint);
[0x55555563caa0] p_constraint
[0x55555563caa0] /nvc/build/../src/parse.c:4226 p_subtype_indication
-->       p_constraint(type);
       }
[0x55555562f76b] /nvc/build/../src/parse.c:6785 p_subtype_declaration
-->    type_t sub = p_subtype_indication();
[0x555555636f9e] p_package_declarative_item
[0x555555636f9e] p_package_declarative_part
[0x555555636f9e] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./829c8caa83d8e941a9cf4d5dbc823735e159a32d4ecd35e5bd95d0b13b8e34af
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c4e2] /nvc/build/../src/parse.c:1500 p_expression_with_head
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x555555650149] /nvc/build/../src/parse.c:4476 p_aggregate_or_expression
-->    tree_t head = p_expression();
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555565dadd] p_condition
[0x55555565dadd] /nvc/build/../src/parse.c:6971 p_assertion
-->    tree_set_value(s, p_condition());
[0x555555656f57] p_assertion_statement
[0x555555656f57] /nvc/build/../src/parse.c:10489 p_sequential_statement
       case tASSERT:
-->       return p_assertion_statement(label);
[0x555555689c2e] p_sequence_of_statements
[0x555555689c2e] p_process_statement_part
[0x555555689c2e] /nvc/build/../src/parse.c:8483 p_process_statement
-->    p_process_statement_part(t);
[0x55555561d2ff] p_concurrent_statement
[0x55555561d2ff] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./8a914f40d873ff7bec49e7993899821246958566831a90b871c3bbc1081a4566
nvc: ../src/simp.c:1454: tree_t simp_range(tree_t): Assertion `attr == ATTR_RANGE || attr == ATTR_REVERSE_RANGE' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x5555557213da] simp_range
[0x5555557213da] /nvc/build/../src/simp.c:1716 simp_tree
       case T_RANGE:
-->       return simp_range(t);
       case T_SEQUENCE:
[0x555555765051] /nvc/build/../src/object.c:715 object_rewrite
       for (;;) {
-->       object_t *new = (*ctx->post_fn[object->tag])(object, ctx->context);
          if (new == object || (object = object_rewrite(new, ctx)) == NULL)
[0x555555764dfd] /nvc/build/../src/object.c:790 object_rewrite
                      object_t *o = object->items[n].obj_array->items[i];
-->                   if ((o = object_rewrite(o, ctx))) {
                         object_write_barrier(object, o);
[0x555555764d05] /nvc/build/../src/object.c:779 object_rewrite
                object_t *o = object->items[n].object;
-->             object->items[n].object = object_rewrite(o, ctx);
                object_write_barrier(object, o);
[0x555555764dfd] /nvc/build/../src/object.c:790 object_rewrite
                      object_t *o = object->items[n].obj_array->items[i];
-->                   if ((o = object_rewrite(o, ctx))) {
                         object_write_barrier(object, o);
[0x5555556ada40] /nvc/build/../src/tree.c:1310 tree_rewrite
-->    object_t *result = object_rewrite(&(t->object), &ctx);
       free(ctx.cache);
[0x555555749ae5] ../src/simp.c:1805 analyse_file
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./a3855bb94f65948ac0f8ca3555d79a537faeeb4cf8fd8273c3dbdea2e586c70f
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x5555558262cd] /nvc/build/../src/names.c:1038 insert_generics
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x555555636d58] p_package_header
[0x555555636d58] /nvc/build/../src/parse.c:8818 p_package_declaration
       if (standard() >= STD_08)
-->       p_package_header(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./a91350302e6a58b6a7a65cc634a1bc58bdec9977c0abd21f41d017ae339a972d
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564ea23] /nvc/build/../src/parse.c:1500 p_relation
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555565bd56] p_condition
[0x55555565bd56] p_next_statement
[0x55555565bd56] /nvc/build/../src/parse.c:10515 p_sequential_statement
       case tNEXT:
-->       return p_next_statement(label);
[0x55555565853e] p_sequence_of_statements
[0x55555565853e] p_loop_statement
[0x55555565853e] /nvc/build/../src/parse.c:10509 p_sequential_statement
       case tFOR:
-->       return p_loop_statement(label);
[0x55555562693f] p_sequence_of_statements
[0x55555562693f] /nvc/build/../src/parse.c:8287 p_subprogram_body
-->    p_sequence_of_statements(spec);
[0x55555562213f] /nvc/build/../src/parse.c:12931 p_package_body_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./c74e31b83a3bd35b2478fef367a3f4b93f8dfeadbe1d7574d81acbbaf4510377
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x555555627498] /nvc/build/../src/parse.c:7265 p_variable_declaration
          tree_add_decl(parent, t);
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x5555556220ba] /nvc/build/../src/parse.c:12936 p_package_body_declarative_item
       case tSHARED:
-->       p_variable_declaration(parent);
          break;
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x555555622239] /nvc/build/../src/parse.c:12987 p_package_body_declarative_item
             require_std(STD_08, "nested package declarations");
-->          tree_add_decl(parent, p_package_body(NULL));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./d3572db6b0680175bbdb7486d2444e480db8de0caff43a0f2230a70a70690086
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x55555562f4f9] /nvc/build/../src/parse.c:6946 p_constant_declaration
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x555555636e68] p_package_declarative_item
[0x555555636e68] p_package_declarative_part
[0x555555636e68] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./d87cece15bccf62714ce1bdd82abbcdacc5f29bc31060c1dc3a56bb91295073b

*** Caught signal 11 (SEGV_MAPERR) [address=0x8, ip=0x55555581fcea] ***

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x55555581fcea] ../src/diag.c:1131 begin_overload_resolution
[0x555555829385] solve_pcall
[0x555555829385] /nvc/build/../src/names.c:4862 _solve_types
       case T_PROT_PCALL:
-->       return solve_pcall(tab, expr);
       case T_LITERAL:
[0x55555582880a] /nvc/build/../src/names.c:4918 solve_types
       type_set_add(tab, constraint, NULL);
-->    type_t type = _solve_types(tab, expr);
       type_set_pop(tab);
[0x55555565b81f] p_procedure_call_statement
[0x55555565b81f] /nvc/build/../src/parse.c:10564 p_sequential_statement
       case tPARAMETER:
-->       return p_procedure_call_statement(label, name);
[0x55555562693f] p_sequence_of_statements
[0x55555562693f] /nvc/build/../src/parse.c:8287 p_subprogram_body
-->    p_sequence_of_statements(spec);
[0x55555562213f] /nvc/build/../src/parse.c:12931 p_package_body_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./eb0266416cde0a67a4ee42260ebb31bb3a0701c1bb2115b998b75d59853bc619
nvc: ../src/tree.c:587: tree_kind_t tree_kind(tree_t): Assertion `t != NULL' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555573bafa] tree_kind
[0x55555573bafa] ../src/tree.c:655 is_subprogram
[0x55555581302f] /nvc/build/../src/names.c:792 make_visible
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x5555558262cd] /nvc/build/../src/names.c:1038 insert_generics
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x555555636d58] p_package_header
[0x555555636d58] /nvc/build/../src/parse.c:8818 p_package_declaration
       if (standard() >= STD_08)
-->       p_package_header(pack);
[0x5555556372a2] p_package_declarative_item
[0x5555556372a2] p_package_declarative_part
[0x5555556372a2] /nvc/build/../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x555555615eac] /nvc/build/../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5555556135e3] p_library_unit
[0x5555556135e3] p_design_unit
[0x5555556135e3] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./eeba3cffabd41ada6f164e360cae4c785ff7bb94130ed6a22fb24c4587533578
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c4e2] /nvc/build/../src/parse.c:1500 p_expression_with_head
-->    tree_t right = (*right_fn)(NULL);
       tree_set_loc(expr, CURRENT_LOC);
[0x555555650149] /nvc/build/../src/parse.c:4476 p_aggregate_or_expression
-->    tree_t head = p_expression();
[0x55555564b03e] /nvc/build/../src/parse.c:4585 p_primary
       case tLPAREN:
-->       return p_aggregate_or_expression();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x55555565dadd] p_condition
[0x55555565dadd] /nvc/build/../src/parse.c:6971 p_assertion
-->    tree_set_value(s, p_condition());
[0x555555656f57] p_assertion_statement
[0x555555656f57] /nvc/build/../src/parse.c:10489 p_sequential_statement
       case tASSERT:
-->       return p_assertion_statement(label);
[0x555555689c2e] p_sequence_of_statements
[0x555555689c2e] p_process_statement_part
[0x555555689c2e] /nvc/build/../src/parse.c:8483 p_process_statement
-->    p_process_statement_part(t);
[0x55555561d2ff] p_concurrent_statement
[0x55555561d2ff] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./f20a87db867edc832fa714c1d5254fcecc167caef43f9fe9018c9e30da7ed243
nvc: ../src/parse.c:4622: tree_t p_primary(tree_t): Assertion `is_scanned_as_psl()' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55555564bc36] /nvc/build/../src/parse.c:4622 p_primary
       case tNONDETV:
-->       assert(is_scanned_as_psl());
          return p_psl_builtin_function_call();
[0x55555564efb9] p_unary_expression
[0x55555564efb9] /nvc/build/../src/parse.c:4704 p_factor
-->    tree_t operand = p_unary_expression(head);
[0x55555564bf73] /nvc/build/../src/parse.c:4743 p_term
-->    tree_t term = p_factor(head);
[0x55555564fb5f] /nvc/build/../src/parse.c:4798 p_simple_expression
       else
-->       expr = p_term(head);
[0x55555564f593] /nvc/build/../src/parse.c:4836 p_shift_expression
-->    tree_t shift = p_simple_expression(head);
[0x55555564e6c3] /nvc/build/../src/parse.c:4893 p_relation
-->    tree_t rel = p_shift_expression(head);
[0x55555564c393] /nvc/build/../src/parse.c:4917 p_expression_with_head
-->    tree_t expr = p_relation(head);
[0x555555664bd8] p_actual_part
[0x555555664bd8] /nvc/build/../src/parse.c:3257 p_association_element
-->    tree_t value = p_actual_part(class, kind);
[0x555555665bf1] p_association_list
[0x555555665bf1] /nvc/build/../src/parse.c:3307 p_actual_parameter_part
-->    p_association_list(call, call, F_SUBPROGRAM);
    }
[0x55555565b4f3] p_procedure_call_statement
[0x55555565b4f3] /nvc/build/../src/parse.c:10564 p_sequential_statement
       case tPARAMETER:
-->       return p_procedure_call_statement(label, name);
[0x55555565853e] p_sequence_of_statements
[0x55555565853e] p_loop_statement
[0x55555565853e] /nvc/build/../src/parse.c:10509 p_sequential_statement
       case tFOR:
-->       return p_loop_statement(label);
[0x55555562693f] p_sequence_of_statements
[0x55555562693f] /nvc/build/../src/parse.c:8287 p_subprogram_body
-->    p_sequence_of_statements(spec);
[0x55555562213f] /nvc/build/../src/parse.c:12931 p_package_body_declarative_item
             else
-->             tree_add_decl(parent, p_subprogram_body(spec));
          }
[0x555555620858] p_package_body_declarative_part
[0x555555620858] /nvc/build/../src/parse.c:13064 p_package_body
-->    p_package_body_declarative_part(body);
[0x5555556180b3] /nvc/build/../src/parse.c:13098 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6
file: ./fc2d4e66b3ea007a59d8becdf1e6eb8a8881ff2eb3f90cd5667bf3f19fcc3471
find: '/usr/local/bin/nvc' terminated by signal 11
file: ./ff398ee0f80582493bc2ba306f2b613eb23628a205de984eb0f64174e1d2c4f2
nvc: ../src/sem.c:3795: _Bool sem_check_array_aggregate(tree_t, nametab_t *): Assertion `akind == A_CONCAT || akind == A_SLICE' failed.

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

[0x55555560d299] /nvc/build/../src/util.c:875 signal_handler
-->    show_stacktrace();
[0x7ffff0b1351f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b679fc] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ffff0b13475] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ffff0af97f2] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ffff0af971a] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7ffff0b0ae95] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x5555556cbe2c] sem_check_array_aggregate
[0x5555556cbe2c] /nvc/build/../src/sem.c:3996 sem_check_aggregate
       if (type_is_array(composite_type))
-->       return sem_check_array_aggregate(t, tab);
       else
[0x5555556c8789] /nvc/build/../src/sem.c:4672 sem_check_qualified
-->       if (!sem_check(value, tab))
             return false;
[0x5555556f4913] /nvc/build/../src/sem.c:2592 sem_check_waveforms
-->          if (!sem_check(value, tab))
                return false;
[0x5555556d0ceb] /nvc/build/../src/sem.c:2972 sem_check_cond_assign
-->       if (!sem_check_waveforms(a, target, tab))
             return false;
[0x55555568c491] /nvc/build/../src/parse.c:10874 p_concurrent_signal_assignment_statement
       if (label) insert_name(nametab, t, NULL);
-->    sem_check(t, nametab);
       return t;
[0x55555561bd04] p_concurrent_statement
[0x55555561bd04] /nvc/build/../src/parse.c:10946 p_concurrent_statement_or_psl
       else
-->       tree_add_stmt(parent, p_concurrent_statement());
    }
[0x555555618e70] p_architecture_statement_part
[0x555555618e70] p_architecture_body
[0x555555618e70] /nvc/build/../src/parse.c:13094 p_secondary_unit
       case tARCHITECTURE:
-->       p_architecture_body(unit);
          break;
[0x555555613593] p_library_unit
[0x555555613593] p_design_unit
[0x555555613593] /nvc/build/../src/parse.c:13236 parse
-->    tree_t unit = p_design_unit();
[0x555555749617] /nvc/build/../src/common.c:2468 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5555555eeed7] analyse
[0x5555555eeed7] /nvc/build/../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5555555ec042] /nvc/build/../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);
find: '/usr/local/bin/nvc' terminated by signal 6

@NikLeberg
Copy link
Contributor

Hi @avelure! Your patch is not accessible anmore. Did you change it to private? Would be very interested in looking at your fuzzing setup.
Did you use AFL or llvm's libfuzzer?

@avelure
Copy link
Author

avelure commented Oct 31, 2024

Sorry, I had forgotten to set the repo public. Should work now.
It uses aflplusplus.

@NikLeberg
Copy link
Contributor

NikLeberg commented Nov 1, 2024

I can reproduce the error from file 12dc86da02baf50abcdb2d9777c5ff7f6ef12056c14535fd30c1ad9e50f71411 with the following more minimized example:

package foo_pkg is 
end foo_pkg;

package body foo_pkg is
  shared variable var : integer; 

  package bar_pkg is
  end bar_pkg;

  package body bar_pkg is
    shared variable var : integer; 
  end package body bar_pkg;
end package body foo_pkg;
nvc crash log
root@nvc:/workspaces/nvc/fuzz_test# nvc --std=08 --ignore-time -a --relaxed --error-limit=1 --psl 12dc86d.vhd 
** Warning: shared variable VAR must have protected type
   > 12dc86d.vhd:5
   |
 5 |   shared variable var : integer; 
   |                   ^^^
nvc: ../src/tree.c:587: tree_kind: Assertion `t != NULL' failed.

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

[0x55bc207ab0c3] ../src/util.c:872 signal_handler
-->    show_stacktrace();
[0x7ff7450a131f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7ff7450fab1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) pthread_kill
[0x7ff7450a126d] (/usr/lib/x86_64-linux-gnu/libc.so.6) raise
[0x7ff7450848fe] (/usr/lib/x86_64-linux-gnu/libc.so.6) abort
[0x7ff74508481a] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7ff745097506] (/usr/lib/x86_64-linux-gnu/libc.so.6) __assert_fail
[0x55bc207eaabd] ../src/tree.c:587 tree_kind
    {
-->    assert(t != NULL);
       return t->object.kind;
[0x55bc2082645f] ../src/common.c:655 is_subprogram
    {
-->    switch (tree_kind(t)) {
       case T_FUNC_DECL:
[0x55bc20880750] ../src/names.c:792 warn_hidden_decl
             return;   // Ignore ports in component, etc.
-->       else if (is_subprogram(it->container))
             return;   // Do not warn when subprogram parameters hide ports
[0x55bc20880c76] ../src/names.c:874 make_visible
             else if (dd->visibility == DIRECT && (dd->mask & mask & N_OBJECT))
-->             warn_hidden_decl(s, dd, decl);
[0x55bc20881792] ../src/names.c:1038 make_visible_slow
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x55bc2088274c] ../src/names.c:1358 insert_name
    {
-->    make_visible_slow(tab->top_scope, alias ?: tree_ident(decl), decl);
    }
[0x55bc207c8b26] ../src/parse.c:7265 p_variable_declaration
          tree_add_decl(parent, t);
-->       insert_name(nametab, t, it->ident);
          sem_check(t, nametab);
[0x55bc207da5e2] ../src/parse.c:12998 p_package_body_declarative_item
       case tSHARED:
-->       p_variable_declaration(parent);
          break;
[0x55bc207da921] ../src/parse.c:13071 p_package_body_declarative_part
       while (not_at_token(tEND))
-->       p_package_body_declarative_item(unit);
    }
[0x55bc207dac8d] ../src/parse.c:13126 p_package_body
-->    p_package_body_declarative_part(body);
[0x55bc207da7b5] ../src/parse.c:13049 p_package_body_declarative_item
             require_std(STD_08, "nested package declarations");
-->          tree_add_decl(parent, p_package_body(NULL));
          }
[0x55bc207da921] ../src/parse.c:13071 p_package_body_declarative_part
       while (not_at_token(tEND))
-->       p_package_body_declarative_item(unit);
    }
[0x55bc207dac8d] ../src/parse.c:13126 p_package_body
-->    p_package_body_declarative_part(body);
[0x55bc207dae2e] ../src/parse.c:13160 p_secondary_unit
       case tPACKAGE:
-->       p_package_body(unit);
          break;
[0x55bc207daf6b] ../src/parse.c:13187 p_library_unit
          if (peek_nth(2) == tBODY)
-->          p_secondary_unit(unit);
          else
[0x55bc207db2e9] ../src/parse.c:13245 p_design_unit
       p_context_clause(unit);
-->    p_library_unit(unit);
[0x55bc207db509] ../src/parse.c:13298 parse
-->    tree_t unit = p_design_unit();
[0x55bc2082b68f] ../src/common.c:2486 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x55bc207a0f9c] ../src/nvc.c:255 analyse
          else
-->          analyse_file(argv[i], jit, state->registry);
       }
[0x55bc207a5716] ../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x55bc207a5c5a] ../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);

Edit: Files that trigger the same crash:

  • 237dc1fae4aa4449167b52e5af0094718eba6de3b79c3676c1f186fd0589cc85
  • 291f781a7966d1fd9f6d08d2319d1607c2e8eb00bfddfd1934373b86c504926e
  • 2b65ad2cdb69369c35d7d777fd176d371435d69906e9636fcb1799c756dc834e
  • 5167d85a877bda6ab1f16c5bdaabd10d0770f1fdffce7e8ea975c936ef622fc9
  • 51fa4f1f438bd4398b99ad3f713af0426f7c83c68efc109d6970d0e465dd78ac
  • 52c07ae78c40db41f4206f42bda1a2d7ff7e49219e3cd3e9753bd0f7c431860f
  • a3855bb94f65948ac0f8ca3555d79a537faeeb4cf8fd8273c3dbdea2e586c70f
  • c74e31b83a3bd35b2478fef367a3f4b93f8dfeadbe1d7574d81acbbaf4510377
  • d3572db6b0680175bbdb7486d2444e480db8de0caff43a0f2230a70a70690086
  • eb0266416cde0a67a4ee42260ebb31bb3a0701c1bb2115b998b75d59853bc619

NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 1, 2024
NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 1, 2024
NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 1, 2024
NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 2, 2024
@NikLeberg
Copy link
Contributor

I can reproduce the error from file 1725b8e09f4abd33a4be1451e6b69e2f56112371ad021eeffd3deb4e2334def1 with the following more minimized example:

package foo is
  alias TO_OCTAL_STRING is ns;
end package foo;
nvc crash log
root@nvc:/workspaces/nvc/fuzz_test# nvc --std=08 -a --relaxed --psl 1725b8e.vhd
nvc: ../src/type.c:164: _type_eq: Assertion `a != NULL' failed.

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

[0x5580cb3ea0c3] ../src/util.c:872 signal_handler
-->    show_stacktrace();
[0x7f0272a1331f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7f0272a6cb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:44 __pthread_kill_implementation
[0x7f0272a6cb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:78 __pthread_kill_internal
[0x7f0272a6cb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:89 pthread_kill@@GLIBC_2.34
[0x7f0272a1326d] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../sysdeps/posix/raise.c:26 raise
[0x7f02729f68fe] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./stdlib/abort.c:79 abort
[0x7f02729f681a] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:94 __assert_fail_base.cold
[0x7f0272a09506] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:103 __assert_fail
[0x5580cb43107a] ../src/type.c:164 _type_eq
    {
-->    assert(a != NULL);
       assert(b != NULL);
[0x5580cb431916] ../src/type.c:264 type_eq
    {
-->    return _type_eq(a, b, false, NULL);
    }
[0x5580cb4bfdb5] ../src/names.c:894 make_visible
          else if (overload && kind == DIRECT
-->                && type_eq(type, tree_type(dd->tree))) {
             if (dd->origin != s) {
[0x5580cb4c0792] ../src/names.c:1038 make_visible_slow
-->    make_visible(s, name, decl, DIRECT, s);
    }
[0x5580cb4c174c] ../src/names.c:1358 insert_name
    {
-->    make_visible_slow(tab->top_scope, alias ?: tree_ident(decl), decl);
    }
[0x5580cb408447] ../src/parse.c:7439 p_alias_declaration
-->    insert_name(nametab, t, NULL);
       sem_check(t, nametab);
[0x5580cb40c3e9] ../src/parse.c:8709 p_package_declarative_item
       case tALIAS:
-->       p_alias_declaration(pack);
          break;
[0x5580cb40c616] ../src/parse.c:8754 p_package_declarative_part
       while (not_at_token(tEND))
-->       p_package_declarative_item(pack);
    }
[0x5580cb40c979] ../src/parse.c:8820 p_package_declaration
-->    p_package_declarative_part(pack);
[0x5580cb40e8bd] ../src/parse.c:9390 p_primary_unit
          else
-->          p_package_declaration(unit);
          break;
[0x5580cb419f79] ../src/parse.c:13189 p_library_unit
          else
-->          p_primary_unit(unit);
          break;
[0x5580cb41a2e9] ../src/parse.c:13245 p_design_unit
       p_context_clause(unit);
-->    p_library_unit(unit);
[0x5580cb41a509] ../src/parse.c:13298 parse
-->    tree_t unit = p_design_unit();
[0x5580cb46a68f] ../src/common.c:2486 analyse_file
             tree_t unit;
-->          while (base_errors = error_count(), (unit = parse())) {
                if (error_count() == base_errors) {
[0x5580cb3dff9c] ../src/nvc.c:255 analyse
          else
-->          analyse_file(argv[i], jit, state->registry);
       }
[0x5580cb3e4716] ../src/nvc.c:2135 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x5580cb3e4c5a] ../src/nvc.c:2297 main
-->    const int ret = process_command(argc, argv, &state);

@nickg
Copy link
Owner

nickg commented Nov 2, 2024

Currently I'm just using the analyze switch for fuzzing which is a bit slow. I guess I could use the --syntax switch to parse the file, but it is missing some of the analysis switches like --psl, --relaxed and --error-limit, though it seems quite easy to add, so maybe I can make a pullrequest.

The --syntax command has some issues at the moment: I don't think it works properly if a file contains multiple design units and NVC has been able to separate parsing from other checks for a long time. I think I'd rather remove it and add --no-save flag to -a that would skip saving the working library to disk.

You might want to try disabling LLVM while you're doing this (--disable-llvm configure flag). Most Linux distributions have disabled lazy binding in recent years which means the whole LLVM library gets loaded at start-up regardless of whether it's used or not, and that thing is huge. Here's an example with bin/nvc linked against libLLVM.so:

 Performance counter stats for './bin/nvc -a ../test/regress/wait1.vhd':

        74,518,234      instructions              #    1.50  insn per cycle         
        49,552,361      cycles                                                      

       0.011137862 seconds time elapsed

       0.005594000 seconds user
       0.005594000 seconds sys

And with --disable-llvm:

 Performance counter stats for './x-interp/bin/nvc -a ../test/regress/wait1.vhd':

        19,419,825      instructions              #    1.53  insn per cycle         
        12,671,157      cycles                                                      

       0.003238301 seconds time elapsed

       0.003335000 seconds user
       0.000000000 seconds sys

So ~4x faster.

@NikLeberg
Copy link
Contributor

NikLeberg commented Nov 2, 2024

Reproducer for error from file 181a6c3f1ee6985b3b3d3f5b38b8d6f81f5c826a761045cb7740b8d93a753314 with the following more minimized example:

ENTITY next_ent IS
END next_ent;

ARCHITECTURE arch OF next_ent IS
  TYPE integer_array IS ARRAY (NATURAL RANGE <>) OF INTEGER;
  FUNCTION func1(ia: integer_array := (1,2,3,next)) RETURN BOOLEAN;
BEGIN
END ARCHITECTURE arch;

Edit: Files that trigger the same crash:

  • 209648284096242ef8e489ec9a8c9878d32f790438edcca953a49bd7bf7ad8f4
  • 3d6eaf8db2d6639e23ef48375bf8637db2916b4fa93f1da0af569e929e0ec2a4
  • 3f3d061108d3a7abc82e067554883df795dbce17ade7348fee15e17524275f5b
  • 47354825eb49e9636e5c14b41152066c063dfb46c47ece41b84eceaef6ebcb87
  • 4788c6e651f9bdbb83fccfa6b861cea794f91ca18db53483e637342df4f2d5d8
  • 4e16949ec326542a03cb8ee829bf5203566412f9579e4450ebf336010a8a64a5
  • 5f97485ea9e89ad928bdf5fffb747446d7d91688ebbe112bce0caa63c9dda2c6
  • 7c96d591351ae9d499df39a80e42815cb94e68692fd17fac9e52bb9001ed70ed
  • 829c8caa83d8e941a9cf4d5dbc823735e159a32d4ecd35e5bd95d0b13b8e34af
  • a91350302e6a58b6a7a65cc634a1bc58bdec9977c0abd21f41d017ae339a972d
  • eeba3cffabd41ada6f164e360cae4c785ff7bb94130ed6a22fb24c4587533578
  • f20a87db867edc832fa714c1d5254fcecc167caef43f9fe9018c9e30da7ed243

@NikLeberg
Copy link
Contributor

Reproducer for error from file 60bc12eff12e4f7e41dc5499ffb25c74da54d4f78c77d1200d3621e7a8d6ca30 with the following (slightly) more minimized example:

library ieee;
use ieee.std_logic_1164.all;

entity GENERIC_WHEN is
   generic( FOO  :     std_logic_vector(1 downto 0) );
   port(    IN1  : in  std_logic_vector(1 downto 0);
            OUT1 : out std_logic_vector(1 downto 0) );
end GENERIC_WHEN;

architecture BEHAVIOUR of GENERIC_WHEN is
begin
   process( IN1 )
   begin
      case IN1 is
         when FOO => OUT1 <= FOO;
         when others => null;
      end case;
   end process;
end BEHAVIOUR;

@nickg I don't really know how that should be fixed. The following dirty hack works, but I'm unsure what effects it causes in the depths of other codepaths.

diff --git a/src/common.c b/src/common.c
index 3b6d24b5..bebd594d 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1599,7 +1599,10 @@ unsigned get_case_choice_char(tree_t value, int depth)
    case T_REF:
       {
          tree_t decl = tree_ref(value);
-         assert(tree_kind(decl) == T_CONST_DECL || tree_kind(decl) == T_ALIAS);
+         tree_kind_t kind = tree_kind(decl);
+         if (kind == T_GENERIC_DECL)
+            return ~0;
+         assert(kind == T_CONST_DECL || kind == T_ALIAS);
          assert(tree_has_value(decl));
          return get_case_choice_char(tree_value(decl), depth);
       }

@NikLeberg
Copy link
Contributor

Reproducer for error from file 8a914f40d873ff7bec49e7993899821246958566831a90b871c3bbc1081a4566 with the following more minimized example:

package timing_pkg is
  type frequency is range real'high;
end package;

@nickg
Copy link
Owner

nickg commented Nov 2, 2024

@nickg I don't really know how that should be fixed. The following dirty hack works, but I'm unsure what effects it causes in the depths of other codepaths.

This code is actually illegal, I misinterpreted the 2008 rule changes. It's the same as #1022 and I'm working on a fix.

@NikLeberg
Copy link
Contributor

Reproducer for error from file d87cece15bccf62714ce1bdd82abbcdacc5f29bc31060c1dc3a56bb91295073b with the following more minimized example:

package foo is
end package;

package body foo is
	procedure bar is
	begin
		report ""                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ;                                                                                                                                                                                                                                                                                                                     natural ;
	end procedure;
end package body;

Note: That line is very long.

NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 7, 2024
NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 8, 2024
NikLeberg added a commit to NikLeberg/nvc that referenced this issue Nov 8, 2024
nickg pushed a commit that referenced this issue Nov 8, 2024
@NikLeberg
Copy link
Contributor

NikLeberg commented Nov 8, 2024

Reproducer for error from file a3855bb94f65948ac0f8ca3555d79a537faeeb4cf8fd8273c3dbdea2e586c70f with the following more minimized example:

package numeric_system_pkg is
	impure function foo
end package;

architecture behav of hello is
begin
	subtype sub is up'att another;
end package;

Note: This is wholly not valid VHDL.

@nickg
Copy link
Owner

nickg commented Nov 10, 2024

I think I'd rather remove it and add --no-save flag to -a that would skip saving the working library to disk.

I've done this now so you can try adding --no-save to save a few milliseconds and some disk I/O.

@NikLeberg
Copy link
Contributor

Then there were 5 cases that seem to hang the parser or the parser takes an abnormal long time to complete.
hangs.zip

All but one hang seems to have been resolved with #1065.

Hang from file 447e0104c3da4bc25acd5d7b20dbdb94ceed99731c823e133eafcf98a6e98d33 can be reproduced with reduced example:

library ieee;
use ieee.std_logic_1164.all;

package hang is
  constant c0 : std_logic_vector (31 downto 0) := 32sb"1"; -- ok
  constant c1 : std_logic_vector (31 downto 0) := 33333333333333332sb"1"; -- hangs
end package;

@NikLeberg
Copy link
Contributor

I don't see an easy fix for the parser hang. The bit string literal seems to be valid and allowed according to the standard. Maybe we can at least add a warning? E.g.:

diff --git a/src/parse.c b/src/parse.c
index 58ee05c1..0f59e37a 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -675,6 +675,11 @@ static tree_t bit_string_to_literal(const char *str, const loc_t *loc)
       return t;
    }
 
+   // sanity check to warn of parser hang
+   if (length > 1000000)
+      warn_at(loc, "bit string literal with a length of %i seems erroreously "
+                   "large, nvc might hang", length);
+
    tree_t *bits LOCAL = NULL;
    if (length >= 0)
       bits = xmalloc_array(length, sizeof(tree_t));

@nickg
Copy link
Owner

nickg commented Dec 1, 2024

I don't see an easy fix for the parser hang. The bit string literal seems to be valid and allowed according to the standard. Maybe we can at least add a warning? E.g.:

There's various places where I limit arrays to INT32_MAX elements (e.g. for signals) and anything larger than 2^32 is unlikely to work even given enough time and memory (tree_chars returns an unsigned for an example). So I'd just do something like:

   if (length > INT32_MAX) {
      error_at(loc, "sorry, bit strings longer than %d elements are not supported", INT32_MAX);
      return t;
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants