http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52941
--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-04-30 19:16:31 UTC --- (In reply to comment #8) > (In reply to comment #7) > > Created attachment 27173 [details] > > Proposed patch > > Looks even better. > > > Only one thing ... is it safe to do the > > "@-r15", "@+r15" stuff in the atomic sequence? I remember there were some > > border cases where things would blow up, but can't recall. I've also > > briefly > > checked with atomic vars being on the stack and it looks OK. > > I don't know about such restrictions, though my knowledge of > SH4A is very limited. Perhaps some weired interaction of ll/sc > and cache? LL/SC and cache interaction should be fine, as far as I understand the HW manual. I think the border case happens when the stack alignment is set to 64 bit. If the atomic sequence is interrupted and the exception/interrupt handling code assumes that the stack is always 64 bit aligned it will blow up.