Liste des Groupes | Revenir à cl c |
On 2024-03-22, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:Kaz Kylheku <433-929-6894@kylheku.com> writes:
That is "observable" in the same sense that the size of a compiled object file is "observable" by executing "ls -l". It is not "observable behaviour" as defined by the C standards.>Yes. It is the observable behavior of an unlinked translation unit.
Are you claiming that a function call is observable behavior?
It can be observed by linking a harness to it, with a main() function
and all else that is required to make it a complete program.
That harness becomes an instrument for observation.
The contents of an object file - or the instructions used in a complete program - are not "observable behaviour" in C. Again, I refer you to 5.1.2.2.2p6.>Of course; it can be observed externally, without doing any reverse
>
Are you saying that the "call" instruction generated for the function
call is *observable behavior*?
engineering on the translated unit.
The text also says (in footnotes) that the phases are for conceptual description only, and in practice they are typically folded together.If an implementation doesn't generateThe text says so. Translation units are separate; semantic analysis is
that "call" instruction because it's able to determine at link time that
the call does nothing, that optimization is forbidden?
finished in translation phase 7; linking in 8.
Removal of unreferenced material at link time is very common. In some fields, it is standard practice to use compiler and linker flags geared at making this easier. It is not really any different than using static libraries - the linker will load all requested static libraries, then throw out all parts that are not transitively reachable from non-library code.What wording in the standard requires a "call" instruction to beAn example would be the removal of material that is not referenced,
generated if they're in different translation units?
>
That's a trivial example, but other link time optimizations that don't
change a program's observable behavior (insert weasel words about
unspecified behavior) are also allowed.
like functions not called anywhere, or entire translation units
whose external names are not referenced. That can cause issues too,
and I've run into them, but I can't call that nonconforming.
Nothing is semantically analyzed across translation units, only the
linkage graph itself, which may be found to be disconnected.
The C standard doesn't deal with CPU instructions. It does not have a concept of "running" a translated translation unit - you can only run a complete program, at which point there is no distinction between the translation units that are "collected" into the program image. It's all fused together into one big lump, with one set of observable behaviours.In phase 8:I don't see anything about /removing/ instructions that have to be
All external object and function references are resolved. Library
components are linked to satisfy external references to functions
and objects not defined in the current translation. All such
translator output is collected into a program image which contains
information needed for execution in its execution environment.
>
I don't see anything about required CPU instructions.
there according to the semantic analysis performed in order to
translate those units from phases 1 - 7, and that can be confirmed
to be present with a test harness.
Les messages affichés proviennent d'usenet.