unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* segfault in GOOPS/C function
@ 2007-06-27  5:40 Marco Maggi
  2007-07-10 22:38 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Maggi @ 2007-06-27  5:40 UTC (permalink / raw)
  To: bug-guile

On Guile 1.8.1 the following:

;; hurt-me.scm --

(define-module (this)
  #:use-module (oop goops))

(define-class <a> ())
(define-class <b> (<a>))

(define-method (doit (o <a>) a b)
  #f)
(define-method (doit (o <b>) c d)
  #f)

(define args (list (make <b>) 1 2))
(define p (compute-applicable-methods doit args))
(define the-one-for-b (car p))
(define the-one-for-a (cadr p))

(method-more-specific? the-one-for-b the-one-for-a '())

;;; end of file

segfaults inside METHOD-MORE-SPECIFIC? because, I think, the
empty list is not recognised  as such. Yeah, maybe the empty
list is  not what this  function expects, but it  should not
dump on me.

[New Thread 16384 (LWP 2231)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 2231)]
0x4006de10 in more_specificp (m1=0x0, m2=0x0, targs=0x0) at
../../libguile/goops.c:1960
1960	      for (l = SCM_SLOT (targs[i], scm_si_cpl);   ; l =
SCM_CDR(l)) {
#0  0x4006de10 in more_specificp (m1=0x0, m2=0x0, targs=0x0)
at ../../libguile/goops.c:1960
#1  0x4006e08f in scm_sys_method_more_specific_p
(m1=0x4033f050, m2=0x4033f190, targs=0x404)
    at ../../libguile/goops.c:2342
#2  0x400604de in ceval (x=0x40410468, env=0x40410218) at
../../libguile/eval.c:4126
#3  0x400629c6 in scm_i_eval_x (exp=0x0, env=0x404107c8) at
inline.h:250
#4  0x4006356e in scm_primitive_eval_x (exp=0x404107f8) at
../../libguile/eval.c:5906
#5  0x400770d1 in scm_primitive_load (filename=0x403491c0)
at ../../libguile/load.c:109
#6  0x400604de in ceval (x=0x404, env=0x40393c58) at
../../libguile/eval.c:4126
#7  0x4006290a in scm_i_eval (exp=0x0, env=0x40393c58) at
inline.h:250
#8  0x4004fb92 in scm_start_stack (id=0x404107c8,
exp=0x4031e9a8, env=0x40393c58)
    at ../../libguile/debug.c:454
#9  0x4004fc10 in scm_m_start_stack (exp=0x404107c8,
env=0x0) at ../../libguile/debug.c:470

--
Marco Maggi




_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: segfault in GOOPS/C function
  2007-06-27  5:40 segfault in GOOPS/C function Marco Maggi
@ 2007-07-10 22:38 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2007-07-10 22:38 UTC (permalink / raw)
  To: bug-guile

Hi Marco,

"Marco Maggi" <marco.maggi-ipsu@poste.it> writes:

> On Guile 1.8.1 the following:

[...]

> segfaults inside METHOD-MORE-SPECIFIC? because, I think, the
> empty list is not recognised  as such. Yeah, maybe the empty
> list is  not what this  function expects, but it  should not
> dump on me.

I fixed this in both branches.

The issue is that TARGS (a list of classes) should be as long as the
smallest list of specializers between that of M1 and that of M2, and
`%method-more-specific?' did not check for this.

Thanks!

Ludovic.




_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-10 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-27  5:40 segfault in GOOPS/C function Marco Maggi
2007-07-10 22:38 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).