]> git.donarmstrong.com Git - lilypond.git/blob - guile18/test-suite/standalone/test-fast-slot-ref.in
Import guile-1.8 as multiple upstream tarball component
[lilypond.git] / guile18 / test-suite / standalone / test-fast-slot-ref.in
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 modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or (at
8 # 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 MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
13 # License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this library; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 # Test for %fast-slot-ref, which was previously implemented such that
20 # an out-of-range slot index could escape being properly detected, and
21 # could then cause a segmentation fault.
22 #
23 # Prior to the change in this commit to goops.c, the following
24 # sequence reliably causes a segmentation fault on my GNU/Linux when
25 # executing the (%fast-slot-ref i 3) line.  For reasons as yet
26 # unknown, it does not cause a segmentation fault if the same code is
27 # loaded as a script; that is why we run it here using "guile -q <<EOF".
28 exec guile -q -l @top_builddir_absolute@/libguile/stack-limit-calibration.scm >/dev/null 2>&1 <<EOF
29 (use-modules (oop goops))
30 (define-module (oop goops))
31 (define-class <c> () (a #:init-value 1) (b #:init-value 2) (c #:init-value 3))
32 (define i (make <c>))
33 (%fast-slot-ref i 1)
34 (%fast-slot-ref i 0)
35 (%fast-slot-ref i 3)
36 (%fast-slot-ref i -1)
37 (%fast-slot-ref i 2)
38 (exit 0)
39 EOF