This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]