From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18807 invoked by alias); 17 May 2003 09:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18736 invoked by uid 71); 17 May 2003 09:26:01 -0000 Resent-Date: 17 May 2003 09:26:01 -0000 Resent-Message-ID: <20030517092601.18734.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nickc@redhat.com Resent-Reply-To: gcc-gnats@gcc.gnu.org, dong_geming@hotmail.com Received: (qmail 1392 invoked by uid 48); 17 May 2003 09:17:13 -0000 Message-Id: <20030517091713.1387.qmail@sources.redhat.com> Date: Sat, 17 May 2003 09:26:00 -0000 From: dong_geming@hotmail.com Reply-To: dong_geming@hotmail.com To: gcc-gnats@gcc.gnu.org Cc: nickc@redhat.com X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: nickc@redhat.com Subject: c/10834: GCC for ARM 3.3 still generates incorrect instructions for functions with __attribute__ ((interrupt ("IRQ"))) X-SW-Source: 2003-05/txt/msg01972.txt.bz2 List-Id: >Number: 10834 >Category: c >Synopsis: GCC for ARM 3.3 still generates incorrect instructions for functions with __attribute__ ((interrupt ("IRQ"))) >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Sat May 17 09:26:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Adam Dong >Release: GCC 3.3 >Organization: >Environment: cygwin --host=i686-pc-cygwin --target=arm-elf >Description: I cmopiled the following file with gcc 3.3 for ARM. /* begin of file ext_irq.c */ void ext_IRQ0_handler(void) __attribute__ ((interrupt ("IRQ"))); void ext_IRQ0_handler(void) { int i = 0; i = i++; } /* end of file ext_irq.c */ If it was Compiled with the following command: arm-elf-gcc -gdwarf ext_irq.c -o.\debug\ext_irq.o then Dump the ext_irq.o, and we can get the following code: 00000000 : 0: e52dc004 str ip, [sp, -#4]! 4: e1a0c00d mov ip, sp 8: e24ee004 sub lr, lr, #4 ; 0x4 c: e92dd80e stmdb sp!, {r1, r2, r3, fp, ip, lr, pc} 10: e24cb004 sub fp, ip, #4 ; 0x4 14: e24dd004 sub sp, sp, #4 ; 0x4 18: e3a03000 mov r3, #0 ; 0x0 1c: e50b3020 str r3, [fp, -#32] 20: e24b1020 sub r1, fp, #32 ; 0x20 24: e5913000 ldr r3, [r1] 28: e1a02003 mov r2, r3 2c: e50b2020 str r2, [fp, -#32] 30: e2833001 add r3, r3, #1 ; 0x1 34: e5813000 str r3, [r1] 38: e95b980e ldmdb fp, {r1, r2, r3, fp, ip, pc}^ On the other way, If it was Compiled with the following command: arm-elf-gcc -mthumb-interwork -gdwarf ext_irq.c -o.\debug\ext_irq.o then Dump the ext_irq.o, and we can get the following code: 00000000 : 0: e52dc004 str ip, [sp, -#4]! 4: e1a0c00d mov ip, sp 8: e24ee004 sub lr, lr, #4 ; 0x4 c: e92dd80e stmdb sp!, {r1, r2, r3, fp, ip, lr, pc} 10: e24cb004 sub fp, ip, #4 ; 0x4 14: e24dd004 sub sp, sp, #4 ; 0x4 18: e3a03000 mov r3, #0 ; 0x0 1c: e50b3020 str r3, [fp, -#32] 20: e24b1020 sub r1, fp, #32 ; 0x20 24: e5913000 ldr r3, [r1] 28: e1a02003 mov r2, r3 2c: e50b2020 str r2, [fp, -#32] 30: e2833001 add r3, r3, #1 ; 0x1 34: e5813000 str r3, [r1] 38: e91b680e ldmdb fp, {r1, r2, r3, fp, sp, lr} 3c: e89d1000 ldmia sp, {ip} 40: e25ef004 subs pc, lr, #4 ; 0x4 ******************************* ***********PROBLEM************* ******************************* Both of the compiled results are not correct. Because the "sp" register is not restored correctly, It can be discovered easily, if we debug this codes on a E.V. board. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: