Incorrect function prologue with Thumb-1 high register variable

Bug #640521 reported by Andrew Stubbs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Won't Fix
Low
Michael Collison

Bug Description

Compiling the following with "-Os -mthumb" results in the caller's r8 being incorrectly clobbered.

void foo(int x)
{
  register int foo asm("r8") = x;
  asm volatile ("@frob %0" :: "r"(foo);
}

GCC chooses not to use r8-r11 when optimizing Thumb-1 for size. However this should not be user-visible. Note that this is the correct behavior when the user specifies -ffixed-r8, care should be taken not the break that.

Discovered while trying to solve a different problem in eglibc.

[CodeSourcery Tracker ID #9085]

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

This is Thumb-1, so setting "low" importance.

Changed in gcc-linaro:
importance: Undecided → Low
Revision history for this message
Michael Hope (michaelh1) wrote :

Andrew, if this has been fixed by CSL then could you please merge it into gcc-linaro? Otherwise we should make sure this is reported upstream and decline this bug.

Changed in gcc-linaro:
status: New → Confirmed
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Confirmed → Triaged
Revision history for this message
Michael Hope (michaelh1) wrote :

Andrew, any thoughts?

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

There's been no change to CSL bug #9085, so I doubt we've fixed this yet.

Changed in gcc-linaro:
assignee: nobody → Michael Collison (michael-collison)
Revision history for this message
Michael Collison (michael-collison) wrote :

Not an issue with Linaro 4.8 or 4.9 as r8 is preserved. Will not fix for older releases.

Changed in gcc-linaro:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.