Re: Reg: Restricting optimization and CR register usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have found an issue related with the condition register usage, while
> migrating to GCC from DIAB compiler. The RTOS used is AMX and the platform
> is PowerPC.

> 1. The comparison result of expression "(argVal < MACRO_VALUE)" is stored
> in
> CR4 initially (exp-1). Since the same expression is used again (exp-2) and
> the 'argVal' is not modified in between these expressions, GCC does not
> re-evaluate the expression, instead uses the already evaluated result from
> CR4 for branch decision.
> But in between these two comparison statements, there is a system call
> where
> the CR4 register is used for expression evaluation. So when the CR4
> register
> is reused in the second if statement (exp-2), the evaluation result goes
> wrong.

CR4 is non-volatile.  If the system calls modify it, your OS is not
compliant to the ABI; you'd need a different ABI.

Maybe you can force GCC to avoid CR4 by using -ffixed-reg=cr4 .


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux