(- (random 3) 2) --> seg fault

From: Harvey J. Stein <hjstein_at_math.huji.ac.il>
Date: Fri, 11 Nov 1994 12:47:06 +0200

Jen Mankoff writes:
>
> I just compiled STk-2.1.4 on the Dec stations (running Ultrix 4.3A)
> here and I ran the turtle demo to test the drawing routines. It
> seg-faulted in the middle of the demo. I think I've traced the problem
> to the following:
>
> (- (random x) y)
>
> when x > y and (random x) returns a value greater than y.
>
> When I called (- (random 3) 2) this using the gdb debugger, I found
> that the error occured in mpz_set at the C level. The bottom part of
> the stack at the moment of the seg-fault looks like this:
>
> (gdb) where
> #0 0x436ee8 in mpz_set (w=0x101b4340, u=0x101b4320) at mpz_set.c:44
> #1 0x4214d8 in clone () at number.c:274
> #2 0x425a40 in difference () at number.c:827
> #3 0x4189ac in leval () at eval.c:147
>

I get the same under Linux. Here're the details:

hjstein:~/STk-2.1.4/Src$ ./stk-bin
Welcome to the STk interpreter version 2.1.4
Copyright (C) 1993, 1994 Erick Gallesio - I3S - CNRS / UNSA <eg_at_unice.fr>
STk> (- (random 3) 2)
Segmentation fault (core dumped)
hjstein:~/STk-2.1.4/Src$ gdb stk-bin core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.8, Copyright 1993 Free Software Foundation, Inc...
Core was generated by ``
#0 0x2f83c in mpz_set (w=0x147e40, u=0x129ef0) at mpz_set.c:44
44 MPN_COPY (w->d, u->d, abs_usize);
(gdb) bt
#0 0x2f83c in mpz_set (w=0x147e40, u=0x129ef0) at mpz_set.c:44
#1 0x12a05 in clone (number=0x103364) at number.c:283
#2 0x1887b in difference (l=0x103328, env=0xd1004) at number.c:833
#3 0x21bd4 in leval (x=0x103334, env=0xd1004) at eval.c:245
#4 0x8f0 in repl_loop () at toplevel.c:155
#5 0xc55 in repl_driver (argc=1, argv=0xbffff9f0) at toplevel.c:252
#6 0xcab in toplevel (argc=1, argv=0xbffff9f0) at toplevel.c:268
#7 0x191 in main (argc=1, argv=0xbffff9f0) at stk.c:30
(gdb)
Received on Fri Nov 11 1994 - 11:55:05 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST