1 /* Copyright (C) 2008 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 /* Test whether `scm_with_guile ()' can be called several times from a given
21 thread, but from a different stack depth. Up to 1.8.5, `scm_with_guile
22 ()' would not update the thread's `base' field, which would then confuse
25 See http://lists.gnu.org/archive/html/guile-devel/2008-11/msg00037.html
26 for a detailed report. */
35 entry_point (void *arg
)
37 /* Invoke the GC. If `THREAD->base' is incorrect, then Guile will just
38 segfault somewhere in `scm_mark_locations ()'. */
45 go_deeper_into_the_stack (unsigned level
)
47 /* The assumption is that the compiler is not smart enough to optimize this
50 go_deeper_into_the_stack (level
- 1);
52 scm_with_guile (entry_point
, NULL
);
57 main (int argc
, char *argv
[])
59 /* Invoke `scm_with_guile ()' from someplace deep into the stack. */
60 go_deeper_into_the_stack (100);
62 /* Invoke it from much higher into the stack. This time, Guile is expected
63 to update the `base' field of the current thread. */
64 scm_with_guile (entry_point
, NULL
);