]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix crash in libcc1
authorTom Tromey <tom@tromey.com>
Wed, 15 Nov 2023 05:27:52 +0000 (22:27 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 16 Nov 2023 04:45:34 +0000 (21:45 -0700)
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.

* libcc1plugin.cc (plugin_build_enum_type): Set
ENUM_UNDERLYING_TYPE.

libcc1/libcc1plugin.cc

index 283eaf206850c6505127a92a1138092d1e320ab0..34dcd89b1b335f7b484e48c0ec7a2b8a9d1b2c44 100644 (file)
@@ -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));