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
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but 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 02110-1301 USA
19 /* Test whether `scm_with_guile ()' can be called several times from a given
20 thread, but from a different stack depth. Up to 1.8.5, `scm_with_guile
21 ()' would not update the thread's `base' field, which would then confuse
24 See http://lists.gnu.org/archive/html/guile-devel/2008-11/msg00037.html
25 for a detailed report. */
34 entry_point (void *arg)
36 /* Invoke the GC. If `THREAD->base' is incorrect, then Guile will just
37 segfault somewhere in `scm_mark_locations ()'. */
44 go_deeper_into_the_stack (unsigned level)
46 /* The assumption is that the compiler is not smart enough to optimize this
49 go_deeper_into_the_stack (level - 1);
51 scm_with_guile (entry_point, NULL);
56 main (int argc, char *argv[])
58 /* Invoke `scm_with_guile ()' from someplace deep into the stack. */
59 go_deeper_into_the_stack (100);
61 /* Invoke it from much higher into the stack. This time, Guile is expected
62 to update the `base' field of the current thread. */
63 scm_with_guile (entry_point, NULL);