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

Crash on incremental configuration #1096

Open
NikLeberg opened this issue Dec 11, 2024 · 1 comment
Open

Crash on incremental configuration #1096

NikLeberg opened this issue Dec 11, 2024 · 1 comment

Comments

@NikLeberg
Copy link
Contributor

I think this could be connected to #1092.

For the following MWE, I expect:

  • The top design unit to report A=2 when ran. But it crashes.
  • the conf design unit to report A=4 when ran. But it crashes.

MWE:

entity ent is
  generic (A: integer := 0);
end entity ent;

architecture arch of ent is
begin
  assert false report "A=" & integer'image(A);
end architecture arch;

--------------------------------------------------------------------------------

entity top is
end entity top;

architecture arch of top is
  component ent is
    generic (A: integer := 1);
  end component ent;
  for inst : ent use entity work.ent generic map (A => 2);
begin
  inst : component ent generic map (A => 3);
end architecture arch;

--------------------------------------------------------------------------------

configuration conf of top is
  for arch
    for inst : ent
      generic map (A => 4);
    end for;
  end for;
end configuration conf;

nvc --std=08 -a --relaxed mwe.vhd -e top -r

crash output
nvc: ../src/tree.c:998: tree_ref: Assertion `item->object != NULL' failed.

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

[0x55f17e925edc] ../src/util.c:897 signal_handler
-->    show_stacktrace();
[0x7f73eea3731f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7f73eea90b1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:44 __pthread_kill_implementation
[0x7f73eea90b1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:78 __pthread_kill_internal
[0x7f73eea90b1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:89 pthread_kill@@GLIBC_2.34
[0x7f73eea3726d] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../sysdeps/posix/raise.c:26 raise
[0x7f73eea1a8fe] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./stdlib/abort.c:79 abort
[0x7f73eea1a81a] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:94 __assert_fail_base.cold
[0x7f73eea2d506] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:103 __assert_fail
[0x55f17e96e814] ../src/tree.c:998 tree_ref
       item_t *item = lookup_item(&tree_object, t, I_REF);
-->    assert(item->object != NULL);
       return container_of(item->object, struct _tree, object);
[0x55f17e9a227b] ../src/simp.c:1727 simp_tree
       case T_PACKAGE_MAP:
-->       simp_generic_map(t, tree_ref(t));
          return t;
[0x55f17e9bddee] ../src/object.c:715 object_rewrite_iter
       for (;;) {
-->       object_t *new = (*ctx->post_fn[object->tag])(object, ctx->context);
          if (new == object || (object = object_rewrite(new, ctx)) == NULL)
[0x55f17e9be54b] ../src/object.c:815 object_rewrite
       else if (ctx->post_fn[object->tag] != NULL) {
-->       object_t *new = object_rewrite_iter(object, ctx);
          object_write_barrier(object, new);
[0x55f17e9be295] ../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);
[0x55f17e9be3b1] ../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);
[0x55f17e9be3b1] ../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);
[0x55f17e971a25] ../src/tree.c:1310 tree_rewrite
-->    object_t *result = object_rewrite(&(t->object), &ctx);
       free(ctx.cache);
[0x55f17e9a25c7] ../src/simp.c:1810 simplify_local
-->    tree_rewrite(top, simp_pre_cb, simp_tree, NULL, &ctx);
[0x55f17e9af779] ../src/common.c:2490 analyse_file
-->                simplify_local(unit, jit, ur);
                   bounds_check(unit);
[0x55f17e91b037] ../src/nvc.c:262 analyse
          else
-->          analyse_file(argv[i], jit, state->registry);
       }
[0x55f17e91fc4a] ../src/nvc.c:2193 process_command
       case 'a':
-->       return analyse(argc, argv, state);
       case 'e':
[0x55f17e92018d] ../src/nvc.c:2355 main
-->    const int ret = process_command(argc, argv, &state);

nvc --std=08 -a --relaxed mwe.vhd -e conf -r

crash output
nvc: ../src/tree.c:998: tree_ref: Assertion `item->object != NULL' failed.

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

[0x55e58626cedc] ../src/util.c:897 signal_handler
-->    show_stacktrace();
[0x7f1c915c531f] (/usr/lib/x86_64-linux-gnu/libc.so.6) 
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:44 __pthread_kill_implementation
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:78 __pthread_kill_internal
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:89 pthread_kill@@GLIBC_2.34
[0x7f1c915c526d] (/usr/lib/x86_64-

nvc: ../src/tree.c:998: tree_ref: Assertion `item->object != NULL' failed.

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

[0x55e58626cedc] ../src/util.c:897 signal_handler
--> show_stacktrace();
[0x7f1c915c531f] (/usr/lib/x86_64-linux-gnu/libc.so.6)
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:44 __pthread_kill_implementation
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:78 __pthread_kill_internal
[0x7f1c9161eb1c] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./nptl/pthread_kill.c:89 pthread_kill@@GLIBC_2.34
[0x7f1c915c526d] (/usr/lib/x86_64-linux-gnu/libc.so.6) ../sysdeps/posix/raise.c:26 raise
[0x7f1c915a88fe] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./stdlib/abort.c:79 abort
[0x7f1c915a881a] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:94 __assert_fail_base.cold
[0x7f1c915bb506] (/usr/lib/x86_64-linux-gnu/libc.so.6) ./assert/assert.c:103 __assert_fail
[0x55e5862b5814] ../src/tree.c:998 tree_ref
item_t *item = lookup_item(&tree_object, t, I_REF);
--> assert(item->object != NULL);
return container_of(item->object, struct _tree, object);
[0x55e5862e927b] ../src/simp.c:1727 simp_tree
case T_PACKAGE_MAP:
--> simp_generic_map(t, tree_ref(t));
return t;
[0x55e586304dee] ../src/object.c:715 object_rewrite_iter
for (;;) {
--> object_t *new = (*ctx->post_fn[object->tag])(object, ctx->context);
if (new == object || (object = object_rewrite(new, ctx)) == NULL)
[0x55e58630554b] ../src/object.c:815 object_rewrite
else if (ctx->post_fn[object->tag] != NULL) {
--> object_t *new = object_rewrite_iter(object, ctx);
object_write_barrier(object, new);
[0x55e586305295] ../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);
[0x55e5863053b1] ../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);
[0x55e5863053b1] ../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);
[0x55e5862b8a25] ../src/tree.c:1310 tree_rewrite
--> object_t *result = object_rewrite(&(t->object), &ctx);
free(ctx.cache);
[0x55e5862e95c7] ../src/simp.c:1810 simplify_local
--> tree_rewrite(top, simp_pre_cb, simp_tree, NULL, &ctx);
[0x55e5862f6779] ../src/common.c:2490 analyse_file
--> simplify_local(unit, jit, ur);
bounds_check(unit);
[0x55e586262037] ../src/nvc.c:262 analyse
else
--> analyse_file(argv[i], jit, state->registry);
}
[0x55e586266c4a] ../src/nvc.c:2193 process_command
case 'a':
--> return analyse(argc, argv, state);
case 'e':
[0x55e58626718d] ../src/nvc.c:2355 main
--> const int ret = process_command(argc, argv, &state);


</details>
@nickg
Copy link
Owner

nickg commented Dec 11, 2024

Yeah this case isn't really supported at the moment. Semantically it should be the same as use open and that would have triggered an assert. I've changed it to report an error instead of crash.

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

2 participants