Artifacts Associated With Ticket 1c60dca341
Ticket change [a7be3a81ab] (rid 198146) by chrstphrchvz on 2022-02-16 00:15:17:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
UBSan (<tt>-fsanitize=signed-integer-overflow</tt>) errors for 32-bit <tt>long</tt> and 64-bit <tt>long long</tt>: <blockquote><pre> % set a -0x8000000000000001; incr a 1 <span style="font-weight:bold">tcl/generic/tclObj.c:3576:6:<span style="color:red"> runtime error: </span>negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself</span> -9223372036854775808 % set b -0x8000000000000001; incr b 0x7fffffff80000001 <span style="font-weight:bold">tcl/generic/tclObj.c:3550:6:<span style="color:red"> runtime error: </span>negation of -2147483648 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself</span> -2147483648 </pre></blockquote> As with [89de498973], this can be avoided by negating before casting, and by subtracting from 0 (binary minus) to avoid compiler warnings for unary minus with unsigned operand (e.g. [https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146|MSVC <tt>/W2</tt> warning C4146]). See attached patch.
- foundin initialized to: "core-8-6-branch"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "48. Number Handling"
- title initialized to: "signed integer overflow in Tcl_SetBignumObj()"
- type initialized to: "Patch"
Add attachment "setbignumobj-sif.diff" [769cb802b5] (rid 198147) by chrstphrchvz on 2022-02-16 00:15:37.
Ticket change [0042dbc24d] (rid 198178) by jan.nijtmans on 2022-02-16 16:12:12:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2459627.17514404"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed[414608568a59da8a|here] Thanks for the report!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"