Re: Seemingly wrong generated code for a function with inline assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/6/22 21:31, mihaidavid--- via Gcc-help wrote:
As you can see, the compiler decided that _retval should be allocated in
register %edi (see the `mov $-1/$-2, $[_retval]` instructions) but
nowhere is it
initialized to 0 as the declaration says, so if `ja` is taken, _retval
is
_undefined_  with a garbage value (I checked with the debugger), but it
should
actually be 0.

_retval is marked in your asm as an output, therefore you have to set it in
the assembly code. gcc knows the assignment to _retval is unused. If you
want to modify _retval, use "+rm", not "=rm".

--
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux