This is the mail archive of the gcc-bugs@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]

Re: GCC-ARM optimization BUG report


> Hello..
> 
> I'm developing In-House RTOS using GCC-ARM.
> gcc_arm generates illegal conditional code sequence with -O option.
> original C-code and it's assembly output are followed.
> 
> /* C-code */
> if(stat_func_tcp)
> 	ptr += stat_func_tcp(ptr);
> 
> /* assembly output */
> 1 : ldrne r3, [r2, #0] /* take function address */
> 2 : movne r0, r4       /* r0 is a register arguement for pointer 'ptr' */
> 3 : movne lr, pc
> 4 : movne pc, r3       /* call stat_func_tcp() */
> 5 : addne r4, r4, r0
> 
> see line 5.
> If CPSR is modified in function stat_func_tcp(),
> 'addne' refers to dirty CPSR, result in skipping add operation.
> 
> No problem without optimize option.
> 
> Is this a BUG?

It depends on which flags you passed to the compiler, and which 
configuration for the ARM that you used.

The above code is legal when the compiler is generating code for an 
ARM2/3, or when generating code for an arm6/7 that is being run in ARM3 
compatibility mode (mode26).

Try adding -mapcs-32 to list of compiler flags.  If this fixes the output 
then you have built a 26-bit mode version of the compiler by default (you 
would be best to select a configuration that builds for apcs-32 mode)




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