This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/61572] [4.10 Regression] ICE: in assign_by_spills, at lra-assigns.c:1335


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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
static inline __attribute__((no_instrument_function)) int
autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
      compat_ulong_t *p)
{
 int rv;
 unsigned long ntimeout;

 if ((rv = ({ int __ret_gu; register
__typeof__(__builtin_choose_expr(sizeof(*(p)) > sizeof(0UL), 0ULL, 0UL))
__val_gu asm("%""rdx"); (void)0; might_fault(); asm volatile("call
__get_user_%P3" : "=a" (__ret_gu), "=r" (__val_gu) : "0" (p), "i"
(sizeof(*(p)))); (ntimeout) = (__typeof__(*(p))) __val_gu; __ret_gu; }))

ok, so the register variable is used to get at the return value of __get_user.

I wonder why that's not using proper constraints instead ...

Probably macro-expansion of GET_USER.

Creepy.

#define get_user(x, ptr)                        \
({                                    \
    int __ret_gu;                            \
    register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX);        \
    __chk_user_ptr(ptr);                        \
    might_fault();                            \
    asm volatile("call __get_user_%P3"                \
             : "=a" (__ret_gu), "=r" (__val_gu)            \
             : "0" (ptr), "i" (sizeof(*(ptr))));        \
    (x) = (__typeof__(*(ptr))) __val_gu;                \
    __ret_gu;                            \
})

Probably because this uses "proper" registers dependent on the size of *ptr
which may end up using a %ecx:%edx register pair.

What a hack to not use a compile-time conditional on sizeof (*ptr).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]