public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4620] core: Synchronize tree-cst & wide-int caching expectations
@ 2020-11-02 16:58 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-11-02 16:58 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a0bc61e0b6da2ff9aca05d7b389a9c114a034052
commit r11-4620-ga0bc61e0b6da2ff9aca05d7b389a9c114a034052
Author: Nathan Sidwell <nathan@acm.org>
Date: Mon Nov 2 08:46:16 2020 -0800
core: Synchronize tree-cst & wide-int caching expectations
I fell over an ICE where wide_int_to_type_1's expectations of pointer
value caching didn't match that of cache_integer_cst's behaviour. I
don't know why it only exhibited on the modules branch, but it seems
pretty wrong. This patch matches up the behaviours and adds a comment
about that.
gcc/
* tree.c (cache_integer_cst): Fixup pointer caching to match
wide_int_to_type_1's expectations. Add comment.
Diff:
---
gcc/tree.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/gcc/tree.c b/gcc/tree.c
index 739c288378a..9260772b846 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1737,6 +1737,8 @@ cache_integer_cst (tree t)
gcc_assert (!TREE_OVERFLOW (t));
+ /* The caching indices here must match those in
+ wide_int_to_type_1. */
switch (TREE_CODE (type))
{
case NULLPTR_TYPE:
@@ -1745,12 +1747,15 @@ cache_integer_cst (tree t)
case POINTER_TYPE:
case REFERENCE_TYPE:
- /* Cache NULL pointer. */
- if (integer_zerop (t))
- {
- limit = 1;
+ {
+ if (integer_zerop (t))
ix = 0;
- }
+ else if (integer_onep (t))
+ ix = 2;
+
+ if (ix >= 0)
+ limit = 3;
+ }
break;
case BOOLEAN_TYPE:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-02 16:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 16:58 [gcc r11-4620] core: Synchronize tree-cst & wide-int caching expectations Nathan Sidwell
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).