bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Integer wraparound bug with eval on OS X


From: Gary V. Vaughan
Subject: Integer wraparound bug with eval on OS X
Date: Mon, 30 Apr 2007 17:49:00 +0100

Hi Eric,

I think your recent patch to eval has either broken something, or else
tickled a long standing bug.  Using the latest gnulib and m4 HEAD, test
135 is failing.  Here is a typescript that illustrates the problem:

$ make check TESTSUITEFLAGS='-v 135'
...
--- -   2007-04-30 17:46:28.000000000 +0100
+++ /Users/gary/Devo/Source/m4--devo--0/+build/tests/testsuite.dir/at- stdout 2007-04-30 17:46:28.000000000 +0100
@@ -5,5 +5,5 @@
overflow occurred
0
-2
--2
+-1
135. generated.at:3309:  FAILED (generated.at:3438)

## ------------- ##
## Test results. ##
## ------------- ##

ERROR: 1 test was run,
1 failed unexpectedly.
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##

Please send `tests/testsuite.log' and all information you think might help:

   To: <address@hidden>
   Subject: [GNU M4 1.9a] testsuite: 135 failed
...
$ ./src/m4
define(`max_int', eval(`-1 >>> 1'))

max_int
9223372036854775807
define(`min_int', eval(max_int` + 1'))

min_int
-9223372036854775808
eval(max_int, 2)
111111111111111111111111111111111111111111111111111111111111111
len(eval(max_int, `2'))
63
eval(len(eval(max_int, `2'))` + 2')
65
eval(`-4 >> 'eval(len(eval(max_int, `2'))` + 2'))
-1
eval(-4 >> 65)
-1
eval(-4 >> 64)
-1
eval(-4 >> 63)
-1
eval(-4 >> 62)
-1
eval(-4 >> 2)
-1
eval(-4 >> 1)
-2
eval(-4 >> 9999999)
-1

The test proper is expecting to see:
$ ./src/m4
eval(`-4 >> 'eval(len(eval(max_int, `2'))` + 2'))
-2

But on my Mac I get:
$ ./src/m4
eval(`-4 >> 'eval(len(eval(max_int, `2'))` + 2'))
-1

Cheers,
        Gary
--
  ())_.              Email me: address@hidden
  ( '/           Read my blog: http://blog.azazil.net
  / )=         ...and my book: http://sources.redhat.com/autobook
`(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912




Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]