[v14,17/40] c-family: Fix C_SET_RID_CODE to handle 16-bit rid code correctly

Message ID 20230915235353.19378-18-kmatsui@gcc.gnu.org
State Superseded
Headers
Series Optimize type traits performance |

Commit Message

Ken Matsui Sept. 15, 2023, 11:51 p.m. UTC
  This patch fixes incorrect handling for the new 16-bit rid code. Unsigned
char was previously used for the 8-bit rid code, but unsigned short is now
required.

gcc/c-family/ChangeLog:

	* c-common.h (C_SET_RID_CODE): Use unsigned short instead of
	unsigned char.

Ref: Initial discussion: https://gcc.gnu.org/pipermail/gcc/2023-September/242460.html
     Code provided by Andrew: https://gcc.gnu.org/pipermail/gcc/2023-September/242461.html
Co-authored-by: Andrew Pinski <pinskia@gmail.com>
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/c-family/c-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 1fdba7ef3ea..73bc23fa49f 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -382,7 +382,7 @@  enum c_tree_index
 #define C_RID_CODE(id) \
   ((enum rid) (((struct c_common_identifier *) (id))->node.rid_code))
 #define C_SET_RID_CODE(id, code) \
-  (((struct c_common_identifier *) (id))->node.rid_code = (unsigned char) code)
+  (((struct c_common_identifier *) (id))->node.rid_code = (unsigned short) code)
 
 /* Identifier part common to the C front ends.  Inherits from
    tree_identifier, despite appearances.  */