unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#15842: Integer overflow on Mac OS X 64-bit
@ 2013-11-09 16:39 Geert Janssens
  2013-11-14  7:22 ` William S Fulton
  2013-11-15  0:25 ` Mark H Weaver
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Janssens @ 2013-11-09 16:39 UTC (permalink / raw)
  To: 15842

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

Hi,

I am experimenting with swig bindings for guile on Mac OS X. One of the 
swig tests (the integer test) is failing. I am aware that swig is not 
guile, but the bug seems to be reproducible in pure guile as well.

When I calculate (2^64) -1 on the Mac OS X platform, it returns -1. On 
my fedora system, the same calculation returns
18446744073709551615

The scheme command used for this is
(display (- (expt 2 64) 1))(newline)

Note that I don't have direct access to a 64-bit Mac OS X system. I have 
run into this bug via that travis CI service.

Here's a link to one of the test runs for swig on that platform:
https://travis-ci.org/gjanssens/swig/jobs/13730706
The output of the calculation as given above is on line 2161.
(The test is missing the (newline) part, so some additional output is 
appended on the same line. This comes from another display command 
though).

I'm not sure what additional information I can provide. If you need, I 
can run more tests indirectly on the travis platform, but other than 
that, my options are fairly limited.

Geert

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

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

* bug#15842: Integer overflow on Mac OS X 64-bit
  2013-11-09 16:39 bug#15842: Integer overflow on Mac OS X 64-bit Geert Janssens
@ 2013-11-14  7:22 ` William S Fulton
  2013-11-15  0:25 ` Mark H Weaver
  1 sibling, 0 replies; 4+ messages in thread
From: William S Fulton @ 2013-11-14  7:22 UTC (permalink / raw)
  To: 15842

I verified the output of:

(display (- (expt 2 64) 1))(newline)

gives -1 using 1.8.8 on OSX Mountain Lion. I then installed Guile 2.0.9 
and the output is 18446744073709551615, so this looks fixed to me. The 
SWIG tests mentioned also pass now.

William





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

* bug#15842: Integer overflow on Mac OS X 64-bit
  2013-11-09 16:39 bug#15842: Integer overflow on Mac OS X 64-bit Geert Janssens
  2013-11-14  7:22 ` William S Fulton
@ 2013-11-15  0:25 ` Mark H Weaver
  2013-11-15  8:24   ` Geert Janssens
  1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2013-11-15  0:25 UTC (permalink / raw)
  To: Geert Janssens; +Cc: 15842-done

Geert Janssens <geert@kobaltwit.be> writes:
> I am experimenting with swig bindings for guile on Mac OS X. One of the 
> swig tests (the integer test) is failing. I am aware that swig is not 
> guile, but the bug seems to be reproducible in pure guile as well.
>
> When I calculate (2^64) -1 on the Mac OS X platform, it returns -1. On 
> my fedora system, the same calculation returns
> 18446744073709551615

When reporting bugs, please tell us what version of Guile you're using.

This is fixed in Guile 2.0.9.  The bug came into existence when clang
started optimizing out overflow checks, on the theory that if a signed
integer overflow occurs then the behavior is unspecified and thus the
compiler can do whatever it likes.

http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=2355f01709eadfd5350c510cdb095b4e3f71f17c
http://stackoverflow.com/questions/14495636/strange-multiplication-behavior-in-guile-scheme-interpreter

I'm closing this bug, on the assumption that you're using an old Guile
release.  Please reopen it if the problem still exists in 2.0.9.

    Thanks!
      Mark





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

* bug#15842: Integer overflow on Mac OS X 64-bit
  2013-11-15  0:25 ` Mark H Weaver
@ 2013-11-15  8:24   ` Geert Janssens
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Janssens @ 2013-11-15  8:24 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: 15842-done


[-- Attachment #1.1: Type: text/plain, Size: 698 bytes --]

On Thursday 14 November 2013 19:25:25 Mark H Weaver wrote:
> When reporting bugs, please tell us what version of Guile you're
> using.
> 
Oops, I should have known better. William S. Fulton (from the Swig project), filled 
in the details in message #8.

> This is fixed in Guile 2.0.9.  The bug came into existence when clang
> started optimizing out overflow checks, on the theory that if a signed
> integer overflow occurs then the behavior is unspecified and thus the
> compiler can do whatever it likes.
> 
As noted by William, the bug appears in 1.8. Is there any chance to get this fix 
backported to that branch ? Or has support for 1.8 stopped completely in the 
meantime ?

Thanks,

Geert

[-- Attachment #1.2: Type: text/html, Size: 3339 bytes --]

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

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

end of thread, other threads:[~2013-11-15  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-09 16:39 bug#15842: Integer overflow on Mac OS X 64-bit Geert Janssens
2013-11-14  7:22 ` William S Fulton
2013-11-15  0:25 ` Mark H Weaver
2013-11-15  8:24   ` Geert Janssens

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