This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, arm][PR88167] Fix __builtin_return_address returns invalid address


Hi All,

In Thumb mode when the function prologue gets expanded, in case of a multiple register push, additional mov instructions are generated to save the high registers which result in lr getting overwritten before it's value can be used to retrieve the return address.

The fix consists of detecting if lr is alive after the prologue, in which case, the lr register won't be used as a scratch.

Regression tested on arm-none-eabi.

gcc/ChangeLog:
2018-11-23  Mihail Ionescu  <mihail.ionescu@arm.com>

	PR target/88167
	* config/arm/arm.c: Add lr liveness check.

gcc/testsuite/ChangeLog
2018-11-23  Mihail Ionescu  <mihail.ionescu@arm.com>

	PR target/88167
	* gcc.target/arm/pr88167.c: New test.

If everything is ok for trunk, could someone commit it on my behalf?

Best regards,
   Mihail


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]