[Bug c/88392] New: Incorrect error message when using bitfields in void *pointer

frederic.petrot@univ-grenoble-alpes.fr gcc-bugzilla@gcc.gnu.org
Thu Dec 6 14:32:00 GMT 2018


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

            Bug ID: 88392
           Summary: Incorrect error message when using bitfields in void
                    *pointer
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frederic.petrot@univ-grenoble-alpes.fr
  Target Milestone: ---

Hello,

the following (arguably quite strange) structure declaration outputs a somewhat
misleading error message on a x86_64 host (Thanks to Mathieu Barbe for pointing
it to my attention):

$ cat b.c
struct {
   void    *v:44;
} z;
$ gcc -Wall -Wextra -fsyntax-only b.c
b.c:2:13: error: bit-field ‘v’ has invalid type
    void    *v:44;
             ^
b.c:2:13: error: width of ‘v’ exceeds its type

The first message is fine, but the second is I believe erroneous as sizeof
(void *) is 8 on that machine. A bit misleading but not a big deal, though.

All the best,
Frédéric


More information about the Gcc-bugs mailing list