Re:The case of a program that crashed on its first instruction
by lieks on Friday November 08, 2024 @04:50PM
(#42090743)
/* Optimize a program.
May perform unsafe optimizations.
May introduce up to 1 bug.
*/
char *optimize(char *program) {
(void) program;
return ".export main\nmain:\n\tub2\n";
}
Re:The case of a program that crashed on its first instruction
by BobbyTables2 on Friday November 08, 2024 @08:05PM
(#42091759)
That’s golden!
Can even make it half the size with an instruction that is invalid in 64bit mode, maybe such as INTO
Re:The case of a program that crashed on its first instruction
by rep_lodsb on Saturday November 09, 2024 @09:12AM
(#42094516)
And that instruction can be removed too: zero byte ".text" section -> page fault
Re:The case of a program that crashed on its first instruction
by 082349872349872 on Saturday November 09, 2024 @02:13AM
(#42092988)
Once, when a bunch of us were sitting in my office trading debugging[0] war stories, the owner of the company dropped in[1], figured out the convo, and interjected:
"That's nothing; I once wrote a single line of assembly that had 3 bugs."
then left...
[0] we'd gotten to the subject because I was in the midst of using an oscope to decide if my ROM monitor or my libc or both were buggy.
[1] perhaps to discover why all the other offices were vacant?
It follows then that with a sufficiently good optimizer every program can be reduced to a single wrong instruction.