Bug 29163 - [gdb/m2] parse_number needs rewrite
Summary: [gdb/m2] parse_number needs rewrite
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: m2 (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 13.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-21 04:01 UTC by Tom de Vries
Modified: 2022-06-04 11:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2022-05-21 04:01:51 UTC
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.
Comment 1 Tom de Vries 2022-05-23 07:43:06 UTC
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.
...