[PATCH] Add 64-bit get_user and __get_user for i386
Jim Wilson
wilson@specifixinc.com
Tue Apr 20 23:35:00 GMT 2004
Jamie Lokier wrote:
> However that doesn't seem to be a problem. Experiments show that an
> __asm__ which outputs to a char or short type is _always_
> sign-extended or zero-extended if needed by the compiler, on various
> i386 subtargets. The compiler doesn't assume anything about the
> output higher bits from an __asm__.
>
> --> GCC experts, can you confirm the above property please?
expand_asm_operands in stmt.c checks for promoted variables, and if it
sees one, it will generate a temporary with the unpromoted size to
replace it in the asm, and then copy the temporary to the promoted
variable after the asm, ensuring that the extension happens after the asm.
> (Function calls are similar: GCC won't assume anything about the
> higher bits of the result received from a function, although it always
> promotes the result before returning a value. Odd combination).
I think this is a minor gcc bug. We have been promoting char/short
return values since the gcc-1.x days. This promotion occurs regardless
of whether the target asks for return values to be promoted. This
promotion happens in start_function in c-decl.c. Perhaps this is a left
over from the K&R C days, as I don't see anything in the C89 standard
that requires this. Changing this now might break ports that require
the promotion, but were not explicitly asking for it, so changing this
might be tricky. I'd suggest opening a gcc bugzilla bug report if we
really care about this.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list