bugGuile - Bugs: bug #21489, crash when incorrectly sorting...


bug #21489: crash when incorrectly sorting methods

Submitter:  Marco Maggi <marcomaggi>
Submitted:  Wed 31 Oct 2007 05:22:52 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Wed 31 Oct 2007 05:22:52 PM UTC, original submission:  

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

Marco Maggi <marcomaggi>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by marcomaggi (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-07-09 None Attached File- Added powered_mysql_80x15.png, #16069

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code