[Bug c/67088] New: Incorrect location of error on invalid type used in bit-field declaration

chengniansun at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 1 06:11:00 GMT 2015


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

            Bug ID: 67088
           Summary: Incorrect location of error on invalid type used in
                    bit-field declaration
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

I define a struct with a bit field but declare it as "double". Gcc emits an
error on it but point to the start of the line, not the location of this
attribution declaration. 

$: cat t.c
struct S {
  double d; double s:1;
};
$: gcc-trunk -c t.c
t.c:2:3: error: bit-field ‘s’ has invalid type
   double d; double s:1;
   ^
$: clang-trunk -c t.c
t.c:2:20: error: bit-field 's' has non-integral type 'double'
  double d; double s:1;
                   ^ ~
1 error generated.
$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror
--with-gmp=/usr/local/gcc-trunk --with-mpfr=/usr/local/gcc-trunk
--with-mpc=/usr/local/gcc-trunk --with-cloog=/usr/local/gcc-trunk
--prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 6.0.0 20150731 (experimental) [trunk revision 226431] (GCC) 
$:


More information about the Gcc-bugs mailing list