mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
fix to program-module
* libguile/programs.c (scm_program_module): Fix an edge case in which this function returned non-modules. Thanks to José Antonio Ortega Ruiz, Caballero del Cálculo Lambda for the report.
This commit is contained in:
parent
cb5a528382
commit
7884975a89
1 changed files with 9 additions and 2 deletions
|
@ -150,10 +150,17 @@ SCM_DEFINE (scm_program_module, "program-module", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_program_module
|
||||
{
|
||||
SCM objs;
|
||||
SCM objs, mod;
|
||||
SCM_VALIDATE_PROGRAM (1, program);
|
||||
objs = SCM_PROGRAM_OBJTABLE (program);
|
||||
return scm_is_true (objs) ? scm_c_vector_ref (objs, 0) : SCM_BOOL_F;
|
||||
/* If a program is the result of compiling GLIL to assembly, then if
|
||||
it has an objtable, the first entry will be a module. But some
|
||||
programs are hand-coded trampolines, like boot programs and
|
||||
primitives and the like. So if a program happens to have a
|
||||
non-module in the first slot of the objtable, assume that it is
|
||||
such a trampoline, and just return #f for the module. */
|
||||
mod = scm_is_true (objs) ? scm_c_vector_ref (objs, 0) : SCM_BOOL_F;
|
||||
return SCM_MODULEP (mod) ? mod : SCM_BOOL_F;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue