[Bug c++/69302] Using bswap in template function with -ftrack-macro-expansion=0 results in a false compiler error

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 16 18:45:00 GMT 2016


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |manu at gcc dot gnu.org
      Known to fail|                            |6.0

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
./test.cc:4:124: error: address requested for ‘__x’, which is declared
‘register’ [-Werror=extra]
   return (__extension__ ({ register unsigned int __v, __x = (0x00000FFF); if
(__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) &
0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) <<
24)); else __asm__ ("bswap %0"\
 : "=r" (__v) : "0" (__x)); __v; }));
                                                                               
                                            ^~~~~~~~~~

;; Function unsigned int foo() [with BLAH = int] (null)
;; enabled by -tree-original


{
  <<cleanup_point return <retval> = {
    register unsigned int __v;
    register unsigned int __x = 4095;

        register unsigned int __v;
    <<cleanup_point     register unsigned int __x = 4095;>>;
    if (0)
      {
        <<cleanup_point <<< Unknown tree: expr_stmt
  (void) (__v = ((*(unsigned int &) &__x >> 24 | *(unsigned int &) &__x >> 8 &
65280) | *(unsigned int &) &__x << 8 & 16711680) | *(unsigned int &) &__x <<
24) >>>>>;
      }
    else
      {
        <<cleanup_point __asm__("bswap %0":"=r" __v:"0" __x)>>;
      }
    __v
  }>>;
}


More information about the Gcc-bugs mailing list