When building with -fsanitize=undefined, I run into: ... $ gdb -q -batch -ex "set lang modula-2" -ex "p /x 010000000000000000H" /home/vries/gdb_versions/devel/src/gdb/m2-exp.y:627:9: runtime error: signed integer overflow: 1152921504606846976 * 16 cannot be represented in type 'long int' $1 = 0x0 ... I guess the parser needs to be rewritten to use ULONGEST, like all the others. Note that the parser is different from others in that it uses the number_sign indicator, so we'll have to add negative number cases as well to gdb.base/parse_number.exp.
Likewise, different line: ... $ gdb -q -batch -ex "set lang modula-2" -ex "p /x -9223372036854775808" /home/vries/gdb_versions/devel/src/gdb/m2-exp.y:639:8: runtime error: signed integer overflow: 9223372036854775800 + 8 cannot be represented in type 'long int' Overflow on numeric constant. ...
https://sourceware.org/pipermail/gdb-patches/2022-May/189313.html
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=999f7adc21cdcef5b606d2529068121dc6032b18