Skip to content

Crash on complex example program while printing goals. #1385

@matthewhammer

Description

@matthewhammer

I have a single .pl file that causes a segmentation fault after I try to suspend the program and print the goals.

The file is called ssa.pl, and is here: matthewhammer/prolog_playground@ea2f9f2

Here's what I see when I try to suspend run_example. and print the goals:

?- [ssa].
Warning: /home/matthew/prolog_playground/examples/ssa.pl:311:
Warning:    Singleton variables: [Nodes]
Warning: /home/matthew/prolog_playground/examples/ssa.pl:345:
Warning:    Singleton variables: [PhiMapOut,VCountersAfterKids,VStacksOut]
Warning: /home/matthew/prolog_playground/examples/ssa.pl:422:
Warning:    Singleton variables: [PhisHere]
Warning: /home/matthew/prolog_playground/examples/ssa.pl:480:
Warning:    Local definition of ssa:pairs_values/2 overrides weak import from pairs
true.

?- run_example.
^CAction (h for help) ? goals
[130,578,533] ssa:dict_pairs(defs{x:[entry, then1], y:[else1], z:[join]}, _15748, _15434)
     [12] ssa:insert_phis([entry, then1, else1, join], df{}, defs{x:[entry, then1], y:[else1], z:[join]}, _15314)

SWI-Prolog [thread 1 (main) at Sun Aug 17 19:26:26 2025]: received fatal signal 11 (segv)
C-stack trace labeled "crash":
  [0] PL_advance_hash_table_enum() at ??:? [0x7e2ac9559b6a]
  [1] Sdprintf() at ??:? [0x7e2ac955ea4d]
  [2] PL_changed_cwd() at ??:? [0x7e2ac9564cd7]
  [3] __restore_rt() at libc_sigaction.c:? [0x7e2ac9242520]
  [4] PL_describe_context() at ??:? [0x7e2ac952c529]
  [5] PL_interrupt() at ??:? [0x7e2ac952c93c]
  [6] Sflush() at ??:? [0x7e2ac95b40f9]
  [7] PL_get_blob() at ??:? [0x7e2ac9585943]
  [8] PL_malloc_atomic() at ??:? [0x7e2ac9571711]
  [9] PL_unify_blob() at ??:? [0x7e2ac95a46c8]
  [10] PL_unify_blob() at ??:? [0x7e2ac95a456c]
  [11] PL_toplevel() at ??:? [0x7e2ac95bbe6f]
  [12] swipl(+0x11a5) [0x5e4d9a1681a5]
  [13] __libc_start_call_main() at ./csu/../sysdeps/nptl/libc_start_call_main.h:58 [0x7e2ac9229d90]
  [14] call_init() at ./csu/../csu/libc-start.c:128 [0x7e2ac9229e40]
  [15] swipl(+0x10c5) [0x5e4d9a1680c5]
Prolog stack:
  [130578533] ssa:dict_pairs/3 [PC=0 in supervisor]
  [12] ssa:insert_phis/4 [PC=12 in clause 1]
  [11] ssa:ssa_convert/2 [PC=95 in clause 1]
  [10] ssa:run_example/0 [PC=10 in clause 1]
  [9] $toplevel:toplevel_call/1 [PC=3 in clause 1]
  [8] $toplevel:stop_backtrace/1 [PC=4 in clause 1]
  [7] $tabling:$wfs_call/2 [PC=17 in clause 1]
  [5] $toplevel:$execute_goal2/3 [PC=29 in clause 1]
  [3] $toplevel:$query_loop/0 [PC=39 in clause 2]
  [2] $toplevel:$runtoplevel/0 [PC=19 in clause 1]
  [1] $toplevel:$toplevel/0 [PC=3 in clause 1]
  [0] system:$c_call_prolog/0 [PC=0 in top query clause]
Running on_halt hooks with status 139
Killing 291220 with default signal handlers
Segmentation fault (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions