This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove UBSAN in dwarf2out.c (PR tree-optimization/82491).
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Sandiford <richard dot sandiford at arm dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 3 Apr 2018 14:31:56 +0200
- Subject: [PATCH] Remove UBSAN in dwarf2out.c (PR tree-optimization/82491).
Hi.
This is second part of the UBSAN. Richard Sandiford help me to wrap the offset
into poly_uint64. The offset is neither logically signed nor logically unsigned.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2018-04-03 Martin Liska <mliska@suse.cz>
PR tree-optimization/82491
* rtl.h (strip_offset_and_add): Replace += suboffset with
poly_uint64 () + suboffset.
---
gcc/rtl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/rtl.h b/gcc/rtl.h
index f31b4ade9d3..0341ba01614 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -4339,7 +4339,7 @@ strip_offset_and_add (rtx x, poly_int64_pod *offset)
{
poly_int64 suboffset;
x = strip_offset (x, &suboffset);
- *offset += suboffset;
+ *offset = poly_uint64 (*offset) + suboffset;
}
return x;
}