https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113382

--- Comment #3 from John David Anglin <danglin at gcc dot gnu.org> ---
btf_kflag is set here:

  else if (btf_kind == BTF_KIND_ENUM)
    {
      btf_kflag = dtd->dtd_enum_unsigned
                    ? BTF_KF_ENUM_UNSIGNED
                    : BTF_KF_ENUM_SIGNED;

(gdb) p dtd->dtd_enum_unsigned
$10 = false

/* BTF_KF_ENUM_ holds the flags for kflags in BTF_KIND_ENUM{,64}.  */
#define BTF_KF_ENUM_UNSIGNED    (0)
#define BTF_KF_ENUM_SIGNED      (1 << 0)

Test has:
enum foo
{
  BAR = 0,
  BAZ = 1,
  QUZ = 2,
  QUX = 3
};

I think the choice of signed int is correct:
https://en.cppreference.com/w/c/language/enum

But then there are articles indicating that the type is implementation
dependent:
https://stackoverflow.com/questions/159034/are-c-enums-signed-or-unsigned

Maybe test needs to handle either case.

Reply via email to