Reify bytevector? in the correct module
[bpt/guile.git] / test-suite / standalone / test-fast-slot-ref.in
CommitLineData
a9931e4e
NJ
1#!/bin/sh
2
3# Copyright (C) 2006 Free Software Foundation, Inc.
4#
53befeb7
NJ
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.
a9931e4e
NJ
9#
10# This library is distributed in the hope that it will be useful, but
53befeb7
NJ
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.
a9931e4e 14#
53befeb7
NJ
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
a9931e4e
NJ
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".
23ccb831 29exec guile -q >/dev/null 2>&1 <<EOF
a9931e4e
NJ
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