diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-28 20:25:26 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-28 21:04:30 +1030 |
commit | c61b7b7b8ea5e3a55b4642dade4798e5c896df66 (patch) | |
tree | db5e3ac4209b78dbad7374778d087e55371102fd /gdb/source.h | |
parent | d7f0f10189fa83a73d9819e81fd321142c0c6398 (diff) | |
download | gdb-c61b7b7b8ea5e3a55b4642dade4798e5c896df66.zip gdb-c61b7b7b8ea5e3a55b4642dade4798e5c896df66.tar.gz gdb-c61b7b7b8ea5e3a55b4642dade4798e5c896df66.tar.bz2 |
Avoid undefined behaviour in m68hc11 md_begin
Given p = A where p is a pointer to some type and A is an array of
that type, then the expression p - 1 + 1 evokes undefined behaviour
according to the C standard.
gcc-13 -fsanitize=address,undefined complains about this, but not
where the undefined behaviour actually occurs at tc-m68hc11.c:646.
Instead you get an error: "tc-m68hc11.c:708:20: runtime error: store
to address 0x62600000016c with insufficient space for an object of
type 'int'". Which is a lie. There most definitely is space there.
Oh well, diagnostics are sometimes hard to get right. The UB is easy
to avoid.
PR 30279
* config/tc-m68hc11.c (md_begin): Avoid undefined pointer
decrement. Remove unnecessary cast.
Diffstat (limited to 'gdb/source.h')
0 files changed, 0 insertions, 0 deletions