3

I'm developing an application with guile and I get some strange errors with it. I suspect that the errors are caused by uninitialized variables in guile or some of the libraries it uses. The problem occurs with both guile versions 2.0 and 2.2.

When I ran guile with valgrind I got the following error (among others):

==9945== Conditional jump or move depends on uninitialised value(s)
==9945==    at 0x4D5005B: GC_push_all_eager (mark.c:1583)
==9945==    by 0x4D514C4: GC_push_current_stack (mark_rts.c:695)
==9945==    by 0x4D4B254: GC_with_callee_saves_pushed (mach_dep.c:322)
==9945==    by 0x4D51535: GC_push_regs_and_stack (mark_rts.c:772)
==9945==    by 0x4D5163E: GC_push_roots (mark_rts.c:845)
==9945==    by 0x4D4D8F5: GC_mark_some (mark.c:351)
==9945==    by 0x4D42CBA: GC_stopped_mark (alloc.c:702)
==9945==    by 0x4D4283C: GC_try_to_collect_inner (alloc.c:488)
==9945==    by 0x4D527B1: GC_init (misc.c:1292)
==9945==    by 0x48BBC22: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==    by 0x48C46EE: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==    by 0x491826D: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==  Uninitialised value was created by a stack allocation
==9945==    at 0x4D4B182: GC_with_callee_saves_pushed (mach_dep.c:227)
==9945== 
==9945== Conditional jump or move depends on uninitialised value(s)
==9945==    at 0x4D50063: GC_push_all_eager (mark.c:1583)
==9945==    by 0x4D514C4: GC_push_current_stack (mark_rts.c:695)
==9945==    by 0x4D4B254: GC_with_callee_saves_pushed (mach_dep.c:322)
==9945==    by 0x4D51535: GC_push_regs_and_stack (mark_rts.c:772)
==9945==    by 0x4D5163E: GC_push_roots (mark_rts.c:845)
==9945==    by 0x4D4D8F5: GC_mark_some (mark.c:351)
==9945==    by 0x4D42CBA: GC_stopped_mark (alloc.c:702)
==9945==    by 0x4D4283C: GC_try_to_collect_inner (alloc.c:488)
==9945==    by 0x4D527B1: GC_init (misc.c:1292)
==9945==    by 0x48BBC22: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==    by 0x48C46EE: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==    by 0x491826D: ??? (in /usr/lib/x86_64-linux-gnu/libguile-2.2.so.1.3.1)
==9945==  Uninitialised value was created by a stack allocation
==9945==    at 0x4D4B182: GC_with_callee_saves_pushed (mach_dep.c:227)
==9945== 

I can't find any uninitialized values in function GC_with_callee_saves_pushed. I tried to memset the context variable in GC_with_callee_saves_pushed to 0 but it didn't help. The second argument to GC_with_callee_saved_pushed in the trace comes from function call to GC_approx_sp in line 702 of alloc.c.

The conditional branch compiled in GC_with_callee_saves_pushed is the one after "#if defined(UNIX_LIKE)...". The else branch of "#if defined(HAVE_BUILTIN_UNWIND_INIT)" is not compiled.

Could this bug be similar to this

Do you have any ideas how to move forward with this?

tohoyn
  • 139
  • 4
  • What are your "strange errors"? – Shawn Jan 02 '19 at 16:27
  • Control flow of the program changed when I added a call to procedure display in a different place. – tohoyn Jan 03 '19 at 16:57
  • An object in guile (wrapped C variable) gets destroyed by the garbage collector even though there is a let variable containing its value. – tohoyn Jan 03 '19 at 16:59
  • If an object is being collected when there is a valid reference to it, it sounds like there is a bug in Guile. Have you reported this to the maintainers? The mailing address is bug-guile@gnu.org. – Skyler Ferris Jan 04 '20 at 01:05

0 Answers0