public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4965] Avoid left shift of negative value in ipa-modref-tree.h
@ 2021-11-05 22:18 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2021-11-05 22:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9cc8ca8da90426f625481195a2127a5e86689bcd
commit r12-4965-g9cc8ca8da90426f625481195a2127a5e86689bcd
Author: Jan Hubicka <hubicka@ucw.cz>
Date: Fri Nov 5 23:17:50 2021 +0100
Avoid left shift of negative value in ipa-modref-tree.h
gcc/ChangeLog:
PR ipa/103082
* ipa-modref-tree.h (struct modref_access_node): Avoid left shift
of negative value
Diff:
---
gcc/ipa-modref-tree.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h
index 9976e489697..bc428d193d2 100644
--- a/gcc/ipa-modref-tree.h
+++ b/gcc/ipa-modref-tree.h
@@ -116,8 +116,13 @@ struct GTY(()) modref_access_node
if (!known_le (parm_offset, a.parm_offset)
&& !range_info_useful_p ())
return false;
+ /* We allow negative aoffset_adj here in case
+ there is an useful range. This is because adding
+ a.offset may result in non-ngative offset again.
+ Ubsan fails on val << LOG_BITS_PER_UNIT where val
+ is negative. */
aoffset_adj = (a.parm_offset - parm_offset)
- << LOG2_BITS_PER_UNIT;
+ * BITS_PER_UNIT;
}
}
if (range_info_useful_p ())
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-05 22:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 22:18 [gcc r12-4965] Avoid left shift of negative value in ipa-modref-tree.h Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).