In function btree_add_symbol, when symbols are added, they're sorted by the symbol* pointer, so each time we run sdcc, we may get the symbols in different order in btree_alloc, thus different machine code may be generated (especially on macOS)
Discussion: Is it possible to get all the same once use stack auto
Wiki: NGI0-Entrust-SDCC
Wiki: SDCC 4.3.0 Release
Diff:
Output reproducibility is a known issue, but there is currently no consensus on how to handle it.
The central question is whether or not fully reproducible compiler output justifies the potential performance penalties.
I think for this case (btree_alloc), we should aim for reproducibility. The performance cost is relatively low (e.g. sort the symbols by name instead of pointer value). AFAIK we do not spend that much time in here (SDCC tends to spend most of its time in register allocation and peephole optimization).
And the nondeterminism here is a rather bad one, as it can change from one run to the next (while the one in the register allocator will only give different results depending on the libraries present at configure and compile time).
Last edit: Philipp Klaus Krause 2023-01-21
Fixed in [r13809].
Related
Commit: [r13809]