[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH] linuxthreads/sysdeps/i386/useldt.h
From: |
Ed Connell |
Subject: |
RE: [PATCH] linuxthreads/sysdeps/i386/useldt.h |
Date: |
Sat, 24 Feb 2001 17:49:34 -0500 |
Ulrich Drepper writes:
> Ed Connell <address@hidden> writes:
>
> > This patch forces gcc to use an 8-bit register (i.e. %cl) for one
> > byte values and a 32-bit register (i.e. %ecx) for 4 byte values.
> > Otherwise gcc complains that the wrong register type is used in the
> > branch that is not taken.
>
> Simply use values of the right type. The patch is not necessary.
Say you call THREAD_GETMEM() with the member being of type char.
Clearly we take the 'if' part of the macro but we get a compile
error in the else part. Since __value is a char, gcc gives it
an 8-bit register (say %cl). But movl isn't allowed to have %cl
as a register (32-bit move into an 8-bit register) and gcc fails.
The reverse happens if member is an int.
Please reconsider.
Cheers,
Ed Connell
Here is the THREAD_GETMEM() part of the patch for reference.
#define THREAD_GETMEM(descr, member) \
({
\
__typeof__ (descr->member) __value;
\
if (sizeof (__value) == 1)
\
__asm__ __volatile__ ("movb %%gs:%P2,%b0"
\
- : "=q" (__value)
\
+ : "=q" ((int8_t)(__value))
\
: "0" (0),
\
"i" (offsetof (struct _pthread_descr_struct,
\
member)));
\
else
\
{
\
if (sizeof (__value) != 4)
\
/* There should not be any value with a size other than 1 or 4. */
\
abort ();
\
\
__asm__ __volatile__ ("movl %%gs:%P1,%0"
\
- : "=r" (__value)
\
+ : "=r" ((int32_t)(__value))
\
: "i" (offsetof (struct _pthread_descr_struct,
\
member)));
\
}
\
__value;
\
})