This is the mail archive of the gcc-prs@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: c/2898: Illegal function return in ARM code when compiling with -mthumb-interwork -O2


The following reply was made to PR c/2898; it has been noted by GNATS.

From: Philip Blundell <philb@gnu.org>
To: trauscher@loytec.com
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: c/2898: Illegal function return in ARM code when compiling with -mthumb-interwork -O2 
Date: Tue, 22 May 2001 18:29:43 +0100

 >When compiling for an ARM target with -mthumb-interwork and -02 or higher 
 >optimization,
 >the compiler does not correctly return with the BX instruction but loads
 >the PC directly. Thus, the function cannot be called from THUMB code
 >safely. 
 
 Thanks for your bug report.
 
 I think the patch below should fix this problem (which, incidentally, is a 
 regression from 2.95).
 
 p.
 
 2001-05-22  Philip Blundell  <philb@gnu.org>
 
 	* config/arm/arm.c (output_return_instruction): Correctly handle
 	interworking and interrupt functions.
 
 Index: arm.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
 retrieving revision 1.142.2.1
 diff -u -p -u -r1.142.2.1 arm.c
 --- arm.c	2001/05/12 20:32:40	1.142.2.1
 +++ arm.c	2001/05/22 17:26:11
 @@ -7045,6 +7065,8 @@ output_return_instruction (operand, real
       load a single register.  On other architectures, the cost is the same.
       In 26 bit mode we have to use LDM in order to be able to restore the CPSR.  */
    if ((live_regs_mask  == (1 << LR_REGNUM))
 +      && ! TARGET_INTERWORK
 +      && ! IS_INTERRUPT (func_type)
        && (! really_return || TARGET_APCS_32))
      {
        if (! really_return)
 
 


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