[Bug c/39170] provide an option to silence -Wconversion warnings for bit-fields

florin.iucha at amd dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 3 14:47:00 GMT 2018


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

--- Comment #18 from Florin Iucha <florin.iucha at amd dot com> ---
Even this version creates a warning:

#include <stdint.h>

struct foo
{
   unsigned bar: 30;
   unsigned fill: 2;
};

struct foo test(uint32_t value)
{
   struct foo foo;

   foo.bar = (value >> 2) & 0x3fffffffU;

   return foo;
}


More information about the Gcc-bugs mailing list