gdb: fix printing of flag enums with multi-bit enumerators
[deliverable/binutils-gdb.git] / gdb / dwarf2 / read.c
index e74383e01dccbe34feb60da15f1e148b54703a29..5a77b62b5a053ee73357e6c43c896453f4fdc419 100644 (file)
@@ -82,6 +82,7 @@
 #include "gdbsupport/selftest.h"
 #include "rust-lang.h"
 #include "gdbsupport/pathstuff.h"
+#include "count-one-bits.h"
 
 /* When == 1, print basic high level tracing messages.
    When > 1, be more verbose.
@@ -15526,10 +15527,15 @@ update_enumeration_type_from_children (struct die_info *die,
          unsigned_enum = 0;
          flag_enum = 0;
        }
-      else if ((mask & value) != 0)
-       flag_enum = 0;
       else
-       mask |= value;
+       {
+         if (count_one_bits_ll (value) >= 2)
+           flag_enum = 0;
+         else if ((mask & value) != 0)
+           flag_enum = 0;
+         else
+           mask |= value;
+       }
 
       /* If we already know that the enum type is neither unsigned, nor
         a flag type, no need to look at the rest of the enumerates.  */
This page took 0.028965 seconds and 4 git commands to generate.