aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-07-13 13:52:03 -0700
committerNathan Sidwell <nathan@acm.org>2020-07-14 06:11:53 -0700
commit6039cb96d1014373470a27f02e24c2c5e821a06c (patch)
tree89687a0ebd054aca8b3de9d485f086e3e93325bf /gcc/tree.c
parent5ed9a5d02fbd446331593ea9804ff55624ad7fba (diff)
downloadgcc-6039cb96d1014373470a27f02e24c2c5e821a06c.zip
gcc-6039cb96d1014373470a27f02e24c2c5e821a06c.tar.gz
gcc-6039cb96d1014373470a27f02e24c2c5e821a06c.tar.bz2
core: add tree-node comments
As we've moved to 64-bit systems, the padding information has become conditionally inaccurate. I also hit cases where invalid tree codes did not get flagged as invalid. gcc/ * tree-core.h (tree_decl_with_vis, tree_function_decl): Note additional padding on 64-bits * tree.c (cache_integer_cst): Note why no caching of enum literals. (get_tree_code_name): Robustify error case.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 3d9968f..9102f8d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1771,6 +1771,8 @@ cache_integer_cst (tree t)
break;
case ENUMERAL_TYPE:
+ /* The slot used by TYPE_CACHED_VALUES is used for the enum
+ members. */
break;
default:
@@ -13254,7 +13256,9 @@ get_tree_code_name (enum tree_code code)
{
const char *invalid = "<invalid tree code>";
- if (code >= MAX_TREE_CODES)
+ /* The tree_code enum promotes to signed, but we could be getting
+ invalid values, so force an unsigned comparison. */
+ if (unsigned (code) >= MAX_TREE_CODES)
{
if (code == 0xa5a5)
return "ggc_freed";