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

            Bug ID: 83294
           Summary: int32_t & related definitions wrong with
                    -funsigned-bitfields
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

The following minimal test case fails with -funsigned-bitfields:

struct { int32_t x:1 } foo;
foo.x = -1;
assert(foo.x < 0);

This is because __INT32_TYPE__, etc. are defined as plain "int" rather than
"signed int", and C specifies that, when the implementation interprets plain
int as unsigned in a bitfield context, it must also do this for typedefs (see
footnote 125 in n1570).

Presumably changing __INT32_TYPE__ and related macros to an explicit "signed
int" will fix the problem.

Reply via email to