1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

Fix errors introduced when giving multiple-values objects a tc7

* libguile/values.c (scm_c_value_ref): Fix a case in which a request for
  the 0th value of a zero-valued object would return the object instead
  of erroring.
* libguile/vm-engine.c (halt): Fix construction of a multiple-valued
  return (off-by-one error).  Fixes a crash introduced in
  4a2d78b4d4.
This commit is contained in:
Andy Wingo 2018-07-16 12:16:58 +02:00
parent 0465c8834e
commit e6461cf1b2
2 changed files with 11 additions and 5 deletions

View file

@ -59,10 +59,16 @@ scm_c_nvalues (SCM obj)
SCM
scm_c_value_ref (SCM obj, size_t idx)
{
if (SCM_LIKELY (scm_is_values (obj) && idx < scm_i_nvalues (obj)))
return scm_i_value_ref (obj, idx);
else if (idx == 0)
return obj;
if (scm_is_values (obj))
{
if (idx < scm_i_nvalues (obj))
return scm_i_value_ref (obj, idx);
}
else
{
if (idx == 0)
return obj;
}
scm_error (scm_out_of_range_key,
"scm_c_value_ref",