Fix crash in libcc1

Message ID 20231115053014.166349-1-tom@tromey.com
State Accepted
Headers
Series Fix crash in libcc1 |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Tom Tromey Nov. 15, 2023, 5:30 a.m. UTC
  The gdb tests of the libcc1 plugin have been failing lately.  I
tracked this down to a crash trying to access an enum's underlying
type.  This patch fixes the crash by setting this type.

libcc1/ChangeLog

	* libcc1plugin.cc (plugin_build_enum_type): Set
	ENUM_UNDERLYING_TYPE.
---
 libcc1/libcc1plugin.cc | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
index 283eaf206850..34dcd89b1b33 100644
--- a/libcc1/libcc1plugin.cc
+++ b/libcc1/libcc1plugin.cc
@@ -454,6 +454,7 @@  plugin_build_enum_type (cc1_plugin::connection *self,
 
   TYPE_PRECISION (result) = TYPE_PRECISION (underlying_int_type);
   TYPE_UNSIGNED (result) = TYPE_UNSIGNED (underlying_int_type);
+  ENUM_UNDERLYING_TYPE (result) = underlying_int_type;
 
   plugin_context *ctx = static_cast<plugin_context *> (self);
   return convert_out (ctx->preserve (result));