[i386] Bug fix where EBP was marked as preserved when it wasn't (fixes #40111)
Summary
This merge request fixes #40111 (closed) where the EBP register was marked as 'preserved' by a procedure when it actually wasn't, causing GetIntRegisterBetween
to start using it on the assumption that it was safe to do so.
System
- Operating system: Linux (possibly others in contrived situations)
- Processor architecture: i386 (possibly i8086 and x86_64 too in contrived situations)
What is the current bug behavior?
When make-cycling the compiler for i386-linux with the options make distclean cycle OPT="-n -gwl"
, a segmentation fault would occur at the whole program optimization stage.
What is the behavior after applying this patch?
Compiler should build successfully.
Additional notes
Two seperate changes were made to ensure this problem was fixed - either one alone should fix it, but this is doubly secure:
- In
tcg386.init_register_allocators
, EBP is not preserved if it's not being used as the frame pointer (but is not marked as usable either unlesscs_useebp
is active). -
GetIntRegisterBetween
will now explicitly exclude EBP from the set of possible registers unlesscs_useebp
is active.