Re: Question about difference in assembly generation

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

 



在 2025-5-14 16:26, Laurent Carlier via Gcc-help 写道:
I’m surprised that there is an assembly generation difference which seems
related to TCO. I.E. there is a `call` instruction generated iso of a `jmp`

In this case it looks like that forcing `fd` to be stored in memory like

   printf("&fd = %p\n", (void*) &fd);

will prevent a tail call. It doesn't matter where you put it, or whether the argument to `close()` is `fd` or not. I don't know a technical reason, however I did encounter such issues a few times ago.

OT: The operation to check for a valid FD is `fd >= 0`, rather than `fd > 0`.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[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