unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Andy Moreton <andrewjmoreton@gmail.com>, emacs-devel@gnu.org
Subject: Re: integer overflow handling for most-negative-fixnum
Date: Sat, 21 Jul 2018 02:49:31 -0700	[thread overview]
Message-ID: <dfb5c6e1-401e-6767-1917-12acc953578a@cs.ucla.edu> (raw)
In-Reply-To: <b713841d-ad3d-bf68-049a-7ae31f9297ee@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

Paul Eggert wrote:
> 
>> Why does the error message ignore the base of the input value ? It
>> should give a more accurate description of the problematic input.
> 
> Yes, it should. I'll see if I can pry loose some time to look into that.

I installed the attached to report the base of the out-of-range fixnum.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Report-base-of-out-of-range-input-fixnums.patch --]
[-- Type: text/x-patch; name="0001-Report-base-of-out-of-range-input-fixnums.patch", Size: 1167 bytes --]

From 1780502da6b9ac8d3063dfd56f675318568283dc Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 21 Jul 2018 00:25:27 -0700
Subject: [PATCH] Report base of out-of-range input fixnums

* src/lread.c (string_to_number): Report the base of an
out-of-range fixnum.  Problem reported by Andy Moreton in:
https://lists.gnu.org/r/emacs-devel/2018-07/msg00696.html
---
 src/lread.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lread.c b/src/lread.c
index 4eba863..50fc6ef 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3798,10 +3798,11 @@ string_to_number (char const *string, int base, int flags)
 
       if (! (state & DOT_CHAR) && ! (flags & S2N_OVERFLOW_TO_FLOAT))
 	{
-	  AUTO_STRING (fmt, ("%s is out of fixnum range; "
+	  AUTO_STRING (fmt, ("%s (base %d) is out of fixnum range; "
 			     "maybe set `read-integer-overflow-as-float'?"));
 	  AUTO_STRING_WITH_LEN (arg, string, cp - string);
-	  xsignal1 (Qoverflow_error, CALLN (Fformat_message, fmt, arg));
+	  xsignal1 (Qoverflow_error,
+		    CALLN (Fformat_message, fmt, arg, make_number (base)));
 	}
     }
 
-- 
2.7.4


      parent reply	other threads:[~2018-07-21  9:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19  2:39 integer overflow handling for most-negative-fixnum Andy Moreton
2018-07-20 22:10 ` Paul Eggert
2018-07-21  5:22   ` Helmut Eller
2018-07-21  9:47   ` Andy Moreton
2018-07-21 10:14     ` Eli Zaretskii
2018-07-21 13:06       ` Andy Moreton
2018-07-21 17:15       ` Stefan Monnier
2018-07-21 17:48         ` Paul Eggert
2018-07-21 18:12           ` Stefan Monnier
2018-07-23 19:18             ` Paul Eggert
2018-07-23 19:57               ` Stefan Monnier
2018-07-23 23:09                 ` Paul Eggert
2018-07-21 20:10           ` Helmut Eller
2018-07-21 21:02             ` Helmut Eller
2018-07-23 19:40             ` Paul Eggert
2018-07-21 18:10         ` Eli Zaretskii
2018-07-21 18:17           ` Paul Eggert
2018-07-21 18:23             ` Eli Zaretskii
2018-07-21 18:42           ` Stefan Monnier
2018-07-21 18:51             ` Eli Zaretskii
2018-07-21 20:42               ` Stefan Monnier
2018-07-21 12:42     ` Helmut Eller
2018-07-21 17:46     ` Paul Eggert
2018-07-23 11:49       ` Andy Moreton
2018-07-23 17:30         ` Paul Eggert
2018-07-23 21:11           ` Andy Moreton
2018-07-24 12:14             ` Andreas Schwab
2018-07-24 13:06               ` Andy Moreton
2018-07-21  9:49   ` Paul Eggert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfb5c6e1-401e-6767-1917-12acc953578a@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=andrewjmoreton@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).