unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#48150: breaking gmp
@ 2021-05-02  1:14 Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language
  2021-05-02 20:01 ` Bengt Richter
  2021-11-05 16:33 ` lloda
  0 siblings, 2 replies; 3+ messages in thread
From: Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language @ 2021-05-02  1:14 UTC (permalink / raw)
  To: 48150

With Guile 2.2.6:

$ guile-2.2 -c '(ash 1 (ash 1 37))'
gmp: overflow in mpz type
zsh: abort      guile-2.2 -c '(ash 1 (ash 1 37))'
$

For shift distances of (ash 1 63) or greater Guile cleanly signals an
exception indicating the overflow.  The above treatment of a range of
smaller (but still stupidly large) shift distances is less than awesome.
It would be preferable for Guile to know gmp's limits and cleanly signal
an exception, rather than exceed those limits in a way that terminates
the process outright.

-zefram





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#48150: breaking gmp
  2021-05-02  1:14 bug#48150: breaking gmp Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language
@ 2021-05-02 20:01 ` Bengt Richter
  2021-11-05 16:33 ` lloda
  1 sibling, 0 replies; 3+ messages in thread
From: Bengt Richter @ 2021-05-02 20:01 UTC (permalink / raw)
  To: Zefram; +Cc: 48150

Hi zefram.

On +2021-05-02 02:14:46 +0100, Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language wrote:
> With Guile 2.2.6:
> 
> $ guile-2.2 -c '(ash 1 (ash 1 37))'
> gmp: overflow in mpz type
> zsh: abort      guile-2.2 -c '(ash 1 (ash 1 37))'
> $
> 
> For shift distances of (ash 1 63) or greater Guile cleanly signals an
> exception indicating the overflow.  The above treatment of a range of
> smaller (but still stupidly large) shift distances is less than awesome.
> It would be preferable for Guile to know gmp's limits and cleanly signal
> an exception, rather than exceed those limits in a way that terminates
> the process outright.
> 
> -zefram
> 
> 
>

Out of curiosity, I tried gdb on your example, running in uname -a:
--8<---------------cut here---------------start------------->8---
Linux LionPure 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
--8<---------------cut here---------------end--------------->8---
which is puri.sm PureOS, a version of debian, with Wayland and Gnome, and tilix as terminal.
--8<---------------cut here---------------start------------->8---

[14:22 ~/bs]$ gdb --args guile-2.2 -c '(ash 1 (ash 1 37))'
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from guile-2.2...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/guile-2.2 -c \(ash\ 1\ \(ash\ 1\ 37\)\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff755b700 (LWP 22904)]
[New Thread 0x7ffff6d5a700 (LWP 22905)]
[New Thread 0x7ffff6559700 (LWP 22906)]
gmp: overflow in mpz type

Thread 1 "guile-2.2" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7b02535 in __GI_abort () at abort.c:79
#2  0x00007ffff78790ad in __gmpz_realloc () from /lib/x86_64-linux-gnu/libgmp.so.10
#3  0x00007ffff787563e in __gmpz_mul_2exp () from /lib/x86_64-linux-gnu/libgmp.so.10
#4  0x00007ffff7eede00 in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#5  0x00007ffff7f4054f in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#6  0x00007ffff7f45d9f in scm_call_n () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#7  0x00007ffff7ec8c27 in scm_primitive_eval () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#8  0x00007ffff7ec8c83 in scm_eval () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#9  0x00007ffff7f4054f in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#10 0x00007ffff7f45d9f in scm_call_n () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#11 0x00007ffff7ec8c27 in scm_primitive_eval () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#12 0x00007ffff7ec8c83 in scm_eval () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#13 0x00007ffff7f14730 in scm_shell () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#14 0x00007ffff7edf53d in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#15 0x00007ffff7ec1e1a in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#16 0x00007ffff7f4054f in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#17 0x00007ffff7f45d9f in scm_call_n () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#18 0x00007ffff7f34794 in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#19 0x00007ffff7ec2400 in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#20 0x00007ffff7ec2495 in scm_c_with_continuation_barrier () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#21 0x00007ffff7f333a6 in ?? () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#22 0x00007ffff7a86ef5 in GC_call_with_stack_base () from /lib/x86_64-linux-gnu/libgc.so.1
#23 0x00007ffff7f33738 in scm_with_guile () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#24 0x00007ffff7edf6d2 in scm_boot_guile () from /lib/x86_64-linux-gnu/libguile-2.2.so.1
#25 0x0000555555555114 in ?? ()
#26 0x00007ffff7b0409b in __libc_start_main (main=0x5555555550b0, argc=3, argv=0x7fffffffde38, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffde28) at ../csu/libc-start.c:308
#27 0x00005555555551aa in ?? ()
(gdb) quit
A debugging session is active.

	Inferior 1 [process 22900] will be killed.

Quit anyway? (y or n) y
--8<---------------cut here---------------end--------------->8---

No time to pursue it further, but it was there in another terminal window, so I thought
I'd copy-paste it as another data point.

-- 
Regards,
Bengt Richter





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#48150: breaking gmp
  2021-05-02  1:14 bug#48150: breaking gmp Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language
  2021-05-02 20:01 ` Bengt Richter
@ 2021-11-05 16:33 ` lloda
  1 sibling, 0 replies; 3+ messages in thread
From: lloda @ 2021-11-05 16:33 UTC (permalink / raw)
  To: 48150-done


Fixed in bf9d30f3c3fd03cb37d604f1927e9ce5c699338b. Thanks!






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-05 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02  1:14 bug#48150: breaking gmp Zefram via Bug reports for GUILE, GNU's Ubiquitous Extension Language
2021-05-02 20:01 ` Bengt Richter
2021-11-05 16:33 ` lloda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).