[Bug c/42492] New: cannot take address of bit-field

yakov at emc dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 24 17:24:00 GMT 2009


This is simular to bug #31541, but different version of gcc.

v4.4.2-152840-release-2.19-2009-10-27_ntv/bin/gcc/configure --disable-nls
--disable-c-mbchar --disable-plugin --disable-werror --disable-shared
--enable-languages=c,c++ --with-gmp=/emc/ucode/Linux-2x-i686/gmp-4.2.2
--with-mpfr=/emc/ucode/Linux-2x-i686/mpfr-2.4.0
--prefix=gcc4x/v4.4.2-152840-release-2.19-2009-10-27_ntv

tst.c: In function 'close_stat_io_no_exp':
tst.c:8: error: cannot take address of bit-field 'stat_rndm'

static void *__memset_native_cnst_zero(void *dest, unsigned int size);
static void *__memset_native_cnst_zero(void *dest, unsigned int size)
{
  unsigned char *d = (unsigned char *)dest;

  if (size >= 8) 
    { 
      do { __asm__ __volatile__("  movq %%xmm0, %0\n" : "=m" (d[0]) : :
"memory", "xmm0"); } 
      while (0); 
      d += 8; 
      size -= 8; 
    }

  return (dest);
}

typedef struct S_STRUCT_STAT_IO
{
  unsigned int stat_rndm :  8;
  unsigned int stat_exp1 : 24;
  unsigned int rndm_exp_word;
} T_STRUCT_STAT_IO;

void close_stat_io_no_exp (void);
void close_stat_io_no_exp (void)
{
   T_STRUCT_STAT_IO close_stat_io;

   if (__builtin_constant_p(sizeof(close_stat_io)))
     __memset_native_cnst_zero((&close_stat_io), (sizeof(close_stat_io)));
}


-- 
           Summary: cannot take address of bit-field
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yakov at emc dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42492



More information about the Gcc-bugs mailing list