if (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_INT)
     {
       attr = dwarf2_attr (die, DW_AT_bit_size, cu);
-      if (attr != nullptr && attr->as_unsigned () <= 8 * type->length ())
+      if (attr != nullptr && attr->form_is_constant ())
        {
-         unsigned real_bit_size = attr->as_unsigned ();
-         attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
-         /* Only use the attributes if they make sense together.  */
-         if (attr == nullptr
-             || (attr->as_unsigned () + real_bit_size
-                 <= 8 * type->length ()))
+         unsigned real_bit_size = attr->constant_value (0);
+         if (real_bit_size >= 0 && real_bit_size <= 8 * type->length ())
            {
-             TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size
-               = real_bit_size;
-             if (attr != nullptr)
-               TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_offset
-                 = attr->as_unsigned ();
+             attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+             /* Only use the attributes if they make sense together.  */
+             if (attr == nullptr
+                 || (attr->form_is_constant ()
+                     && attr->constant_value (0) >= 0
+                     && (attr->constant_value (0) + real_bit_size
+                         <= 8 * type->length ())))
+               {
+                 TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size
+                   = real_bit_size;
+                 if (attr != nullptr)
+                   TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_offset
+                     = attr->constant_value (0);
+               }
            }
        }
     }
 
                _op .ascii [_quote $value]
            }
 
+           DW_FORM_implicit_const -
            DW_FORM_flag_present {
                # We don't need to emit anything.
            }
            }
            _op .uleb128 $_constants($attr_name) $attr_name
            _op .uleb128 $_constants($attr_form) $attr_form_comment
+           if {$attr_form eq "DW_FORM_implicit_const"} {
+               _op .sleb128 $attr_value "the constant"
+           }
        }
     }