1#!/bin/sh 2 3# Copyright (C) 2006 Free Software Foundation, Inc. 4# 5# This library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Lesser General Public License 7# as published by the Free Software Foundation; either version 3 of 8# the License, or (at your option) any later version. 9# 10# This library is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Lesser General Public License for more details. 14# 15# You should have received a copy of the GNU Lesser General Public 16# License along with this library; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18# 02110-1301 USA 19 20# Test for %fast-slot-ref, which was previously implemented such that 21# an out-of-range slot index could escape being properly detected, and 22# could then cause a segmentation fault. 23# 24# Prior to the change in this commit to goops.c, the following 25# sequence reliably causes a segmentation fault on my GNU/Linux when 26# executing the (%fast-slot-ref i 3) line. For reasons as yet 27# unknown, it does not cause a segmentation fault if the same code is 28# loaded as a script; that is why we run it here using "guile -q <<EOF". 29exec guile -q >/dev/null 2>&1 <<EOF 30(use-modules (oop goops)) 31(define-module (oop goops)) 32(define-class <c> () (a #:init-value 1) (b #:init-value 2) (c #:init-value 3)) 33(define i (make <c>)) 34(%fast-slot-ref i 1) 35(%fast-slot-ref i 0) 36(%fast-slot-ref i 3) 37(%fast-slot-ref i -1) 38(%fast-slot-ref i 2) 39(exit 0) 40EOF 41