unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #21489] crash when incorrectly sorting methods
@ 2007-10-31 17:22 Marco Maggi
  2008-07-09  7:32 ` anonymous
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Maggi @ 2007-10-31 17:22 UTC (permalink / raw)
  To: Marco Maggi, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?21489>

                 Summary: crash when incorrectly sorting methods
                 Project: Guile
            Submitted by: marcomaggi
            Submitted on: mercoledì 31/10/2007 alle 17:22
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

I know that the correct way to do it is:

  (sort-applicable-methods <genfunc> 
    (compute-applicable-methods <genfunc> arg ...) arg ...)

so the  following will "never" happen,  but nevertheless the
following segfaults Guile  1.8.3 on a i686-pc-linux-gnu with
GCC 4.1.2, CFLAGS="-O3 -g -march=i686 -mtune=i686".

;; hurtme.scm --

(define-module (one)
  #:use-module (oop goops)
  #:duplicates merge-generics)

(define saved-length length)
(define-generic length)
(define-method (length . args)
  (apply saved-length o))

(define-method (length (o <vector>))
  (vector-length o))

(export length)

(define-module (hurt-me)
  #:use-module (oop goops)
  #:use-module (one)
  #:duplicates merge-generics)

(sort-applicable-methods length
  (generic-function-methods length) '(1 2 3))

;; end of file

The actual crashing code is in 'more_specificp()'.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212094784 (LWP 22856)]
scm_sys_method_more_specific_p (m1=0xb7bc3160, m2=0xb7bc3130,
targs=0xb7b3f3f0) at goops.c:1961
1961		if (cs1 == SCM_CAR(l))
#0  scm_sys_method_more_specific_p (m1=0xb7bc3160, m2=0xb7bc3130,
targs=0xb7b3f3f0) at goops.c:1961
#1  0xb7e40876 in ceval (x=<value optimized out>, env=0xb7b3ed18) at
eval.c:4560
#2  0xb7e462ad in call_closure_2 (proc=0xb7b3f390, arg1=0xb7bc3160,
arg2=0xb7bc3130) at eval.c:5347
#3  0xb7e80fb2 in scm_merge_list_step (seq=0xbf831c70, cmp=0xb7e46250
<call_closure_2>, less=0xb7b3f390, n=2) at sort.c:348
#4  0xb7e82610 in scm_sort_x (items=0x404, less=0xb7b3f390) at sort.c:384
#5  0xb7e826e7 in scm_sort (items=0xb7bea680, less=0xb7b3f390) at sort.c:411
#6  0xb7e41782 in ceval (x=0x404, env=0xb7b3f3c8) at eval.c:4349
#7  0xb7e4603a in scm_primitive_eval_x (exp=0xb7b3cf38) at eval.c:5910
#8  0xb7e5faef in scm_primitive_load (filename=0xb7ba4c20) at load.c:109
#9  0xb7e4169f in ceval (x=0x404, env=0xb7b90fe0) at eval.c:4223
#10 0xb7e2d56b in scm_start_stack (id=0xb7b9d440, exp=0xb7bfe2d8,
env=0xb7b90fe0) at debug.c:454
#11 0xb7e2dd55 in scm_m_start_stack (exp=<value optimized out>,
env=0xb7b90fe0) at debug.c:470
#12 0xb7e43495 in scm_apply (proc=<value optimized out>, arg1=0xb7bfe310,
args=<value optimized out>) at eval.c:4930
#13 0xb7e401e2 in ceval (x=<value optimized out>, env=0xb7b90fe0) at
eval.c:4050
#14 0xb7e45b9f in scm_call_0 (proc=0xb7b90fa8) at eval.c:4655
#15 0xb7e479bd in apply_thunk (thunk=0xb7b90fa8) at fluids.c:396
#16 0xb7e47b9e in scm_c_with_fluid (fluid=0x80620e0, value=0x4,
cproc=0xb7e479a0 <apply_thunk>, cdata=0xb7b90fa8)
    at fluids.c:459
#17 0xb7e47bf5 in scm_with_fluid (fluid=0x80620e0, value=0x4,
thunk=0xb7b90fa8) at fluids.c:446
#18 0xb7e40876 in ceval (x=<value optimized out>, env=0xb7b90f68) at
eval.c:4560
#19 0xb7e45b9f in scm_call_0 (proc=0xb7b90d70) at eval.c:4655
(gdb) 





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?21489>

_______________________________________________
  Messaggio inviato con/da Savannah
  http://savannah.gnu.org/



_______________________________________________
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

* [bug #21489] crash when incorrectly sorting methods
  2007-10-31 17:22 [bug #21489] crash when incorrectly sorting methods Marco Maggi
@ 2008-07-09  7:32 ` anonymous
  0 siblings, 0 replies; 2+ messages in thread
From: anonymous @ 2008-07-09  7:32 UTC (permalink / raw)
  To: Marco Maggi, bug-guile


Additional Item Attachment, bug #21489 (project guile):

File name: powered_mysql_80x15.png        Size:3 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?21489>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

end of thread, other threads:[~2008-07-09  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 17:22 [bug #21489] crash when incorrectly sorting methods Marco Maggi
2008-07-09  7:32 ` anonymous

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).