bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #21489] crash when incorrectly sorting methods


From: Marco Maggi
Subject: [bug #21489] crash when incorrectly sorting methods
Date: Wed, 31 Oct 2007 17:22:53 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]