Re: Is PRE architecture dependent? aarch64 vs x86_64

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

 



On 19/07/2025 21:54, Segher Boessenkool wrote:
On Sat, Jul 19, 2025 at 12:57:46PM +0200, David Brown wrote:
"IB" and "UB" are a world apart.  "IB" lets you write efficient low-level
code tuned to a specific compiler, target or system, at the price of
portability.  It is perfectly fine - indeed crucial to most C programs - to
rely on "IB".  It is never appropriate to rely on the effects of "UB".

An implementation is free to implement any particular IB as UB, it just
has to document it does that!


Writing "the compiler does not define this behaviour" is not defining or documenting anything.

It seems to me - with all due respect - that you fundamentally misunderstand what "implementation-defined behaviour" means.

Can I suggest you read the relevant section of the gcc manual at <https://gcc.gnu.org/onlinedocs/gcc/C-Implementation.html>, and perhaps the corresponding Annex J.2 of the C standards (any version should do, the changes there are minor) ?

Please think about what it would mean if a compiler documented any of these IB's as UB. Think how "useful" a C compiler would be if it declared that the size of an "int" is undefined behaviour, or any other of the many IB's in C.

If that does not convince you, then I am don't know what else to say without going round in circles. While I have studied the C standards more than the solid majority of C programmers, I have no grounds for claiming authority or expecting you to agree just because /I/ said so. However, there are plenty of GCC developers who have a detailed understanding of the standards and are maybe even involved in them, who might be able to help here.

David








[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