BUG #5592: list of integer undefined behaviors - Mailing list pgsql-bugs

From John Regehr
Subject BUG #5592: list of integer undefined behaviors
Date
Msg-id 201008021816.o72IGxsQ044077@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5592: list of integer undefined behaviors
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5592
Logged by:          John Regehr
Email address:      regehr@cs.utah.edu
PostgreSQL version: head 8/1/10
Operating system:   OSX
Description:        list of integer undefined behaviors
Details:

Below: a list of integer undefined behaviors that occur when running "make
check" on yesterday's postgresql on an x86-64 Mac Mini.

Here we're using the ANSI C rules for overflow.  Of course many/most of
these errors are not errors when the -fwrapv rules are in effect.

The last error in the list I already reported, just leaving it in for
completeness.

If more details are needed please let me know.

John Regehr



<bitmapset.c, (752:8)> : Op: -, Reason : Signed Subtraction Overflow, UNARY
OPERATION: right (int32): -2147483648

<int.c, (1002:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int32): -2147483647 right (int32): 2

<int.c, (1023:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int32): 2147483647 right (int32): 2

<int.c, (641:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int32): 2147483647 right (int32): 2

<int.c, (662:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int32): -2147483647 right (int32): 2

<int.c, (695:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int32): 2147483647 right (int32): 2

<int.c, (981:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int32): 2147483647 right (int32): 2

<int8.c, (1028:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 100 right (int64): 9223372036854775800

<int8.c, (1049:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int64): -100 right (int64): 9223372036854775800

<int8.c, (104:23)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 3908203590239580293 right (int64): 10

<int8.c, (104:28)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64): 9

<int8.c, (1070:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 100 right (int64): 9223372036854775800

<int8.c, (497:11)> : Op: -, Reason : Signed Subtraction Overflow, UNARY
OPERATION: right (int64): -9223372036854775808

<int8.c, (521:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64):
9223372036854775800

<int8.c, (542:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64):
-9223372036854775800

<int8.c, (563:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 4567890123456789 right (int64): 4567890123456789

<int8.c, (623:24)> : Op: -, Reason : Signed Subtraction Overflow, UNARY
OPERATION: right (int64): -9223372036854775808

<int8.c, (748:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64): 100

<int8.c, (769:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int64): -9223372036854775800 right (int64): 100

<int8.c, (790:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64): 100

<int8.c, (844:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 100 right (int64): 9223372036854775800

<int8.c, (865:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int64): -100 right (int64): 9223372036854775800

<int8.c, (886:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 100 right (int64): 9223372036854775800

<int8.c, (932:16)> : Op: +, Reason : Signed Addition Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64): 100

<int8.c, (953:16)> : Op: -, Reason : Signed Subtraction Overflow, BINARY
OPERATION: left (int64): -9223372036854775800 right (int64): 100

<int8.c, (974:16)> : Op: *, Reason : Signed Multiplication Overflow, BINARY
OPERATION: left (int64): 9223372036854775800 right (int64): 100

<nabstime.c, (1193:21)> : Op: -, Reason : Signed Subtraction Overflow,
BINARY OPERATION: left (int32): 2147483644 right (int32): -2147483648

<nabstime.c, (1194:21)> : Op: -, Reason : Signed Subtraction Overflow,
BINARY OPERATION: left (int32): 2147483644 right (int32): -2147483648

<tsquery_util.c, (48:18)> : Op: <<, Reason : Signed Left Shift Error: Right
operand is negative or is greater than or equal to the width of the promoted
left operand, BINARY OPERATION: left (int32): 1 right (int32): -25

pgsql-bugs by date:

Previous
From: John Regehr
Date:
Subject: Re: BUG #5590: undefined shift behavior
Next
From: Greg Stark
Date:
Subject: Re: BUG #5592: list of integer undefined behaviors