Sujet : Re: A Famous Security Bug
De : 433-929-6894 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 22. Mar 2024, 18:28:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240322102255.834@kylheku.com>
References : 1 2 3 4 5 6
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-03-22, James Kuyper <
jameskuyper@alumni.caltech.edu> wrote:
On 3/21/24 16:46, Keith Thompson wrote:
...
Link time optimization is as valid as cross-function optimization *as
long as* it doesn't change the defined behavior of the program.
>
Minor adjustment: due to unspecified behavior, some code can have
multiple permitted behaviors. LTO could be conforming even if it changed
the behavior, as long as it changes it to one of the other permitted
behaviors. For implementation-defined behavior, the fact that the change
could happen would have to be documented.
Some unspecified behaviors can change at execution time, like the
unspecified value of an uninitialized unsigned char object in
a malloc-ed block.
If the unspecified behavior a translation unit is changed to another in
a way that obviously requires semantic analysis (such that a change
occurs in the translated unit that amounts to it having been
re-translated) then that appears to violate the requirements in ISO C
about semantic analysis being done in phase 7, and not any later.
I think translation units can be retained in a form that has not
completely gone through translation phase 7. Such that before linkage,
analysis can take place which completes phase 7, before 8 begins.
However, that analysis has to be done in isolation. The standard
describes translation units as being separate.
If we take N translation units from phases 1 to 6, and halfway through
7, and then to complete the semantic analysis of phase 7, the translator
peeks across all N units, then that is no longer proper separation of
translation units right through phase 7. Combination of translation
units can only begin in 8, by which time semantic analysis is done.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca