public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
@ 2005-08-05 16:11 th dot r dot klein at web dot de
  2005-08-05 16:13 ` [Bug target/23250] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-05 16:11 UTC (permalink / raw)
  To: gcc-bugs

The older version of gcc produces corret code e.g.:

arm-elf-gcc-3.4.4 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 3_4_4_thumb.o

3_4_4_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   .
   register r10 (sl) never been used
   .
  52:	2000      	movs	r0, #0
  54:	bc70      	pop	{r4, r5, r6}
  56:	bc02      	pop	{r1}
  58:	4708      	bx	r1

The newer version did not generats the correct code

arm-elf-gcc-4.0.1 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 4_0_1_thumb.o

4_0_1_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   a:	4656      	mov	r6, sl
   c:	b440      	push	{r6}
   .
   register r10 (sl) never been used
   .
  56:	2000      	movs	r0, #0
  58:	bc04      	pop	{r2}
  5a:	4692      	mov	sl, r2
  5c:	bd70      	pop	{r4, r5, r6, pc}
  
After the pop istuction the processor is still in thumb mode but it should be
in ARM mode.
The pop instuction might work in Archiceture version 5 and above but not in
architecture version 4.

The register sl isn't used within the function so push and pop of this not what
I'm expecting if switch -Os is given.
I can't distinguish if this is a resulting bug of the pervious or an extra
optimisation bug.

-- 
           Summary: 4.0.1 switch -mcallee-super-interworking generating
                    wrong code for ARM7TDMI
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: th dot r dot klein at web dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-elf-freebsd
GCC target triplet: arm-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
@ 2005-08-05 16:13 ` pinskia at gcc dot gnu dot org
  2005-08-05 16:35 ` [Bug target/23250] [4.0/4.1 regression] " rearnsha at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-05 16:13 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
  2005-08-05 16:13 ` [Bug target/23250] " pinskia at gcc dot gnu dot org
@ 2005-08-05 16:35 ` rearnsha at gcc dot gnu dot org
  2005-08-11 14:20 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-08-05 16:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-08-05 16:35 -------
Confirmed.  Note, you can work around the problem by passing -mthumb-interwork
in addition to -mcallee-super-interworking.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |4.0.1 4.1.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-05 16:35:06
               date|                            |
            Summary|4.0.1 switch -mcallee-super-|[4.0/4.1 regression] 4.0.1
                   |interworking generating     |switch -mcallee-super-
                   |wrong code for ARM7TDMI     |interworking generating
                   |                            |wrong code for ARM7TDMI
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
  2005-08-05 16:13 ` [Bug target/23250] " pinskia at gcc dot gnu dot org
  2005-08-05 16:35 ` [Bug target/23250] [4.0/4.1 regression] " rearnsha at gcc dot gnu dot org
@ 2005-08-11 14:20 ` cvs-commit at gcc dot gnu dot org
  2005-08-11 14:33 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-11 14:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-11 14:20 -------
Subject: Bug 23250

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rearnsha@gcc.gnu.org	2005-08-11 14:20:25

Modified files:
	gcc            : ChangeLog 
	gcc/config/arm : arm.c 

Log message:
	PR target/23250
	* arm.c (arm_override_options): If the user has selected callee-super-
	interworking, then enable normal interworking.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9703&r2=2.9704
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&r1=1.471&r2=1.472



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (2 preceding siblings ...)
  2005-08-11 14:20 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-11 14:33 ` cvs-commit at gcc dot gnu dot org
  2005-08-11 14:35 ` rearnsha at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-11 14:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-11 14:33 -------
Subject: Bug 23250

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	rearnsha@gcc.gnu.org	2005-08-11 14:33:19

Modified files:
	gcc            : ChangeLog 
	gcc/config/arm : arm.c 

Log message:
	PR target/23250
	* arm.c (arm_override_options): If the user has selected callee-super-
	interworking, then enable normal interworking.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.362&r2=2.7592.2.363
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.430.2.2&r2=1.430.2.3



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (3 preceding siblings ...)
  2005-08-11 14:33 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-11 14:35 ` rearnsha at gcc dot gnu dot org
  2005-08-12 11:54 ` th dot r dot klein at web dot de
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-08-11 14:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2005-08-11 14:35 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (4 preceding siblings ...)
  2005-08-11 14:35 ` rearnsha at gcc dot gnu dot org
@ 2005-08-12 11:54 ` th dot r dot klein at web dot de
  2005-08-12 12:24 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-12 11:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From th dot r dot klein at web dot de  2005-08-12 11:54 -------

The patch did not compiles with keyword MASK_INTERWORK
so using keyword ARM_FLAG_INTERWORK instead

--- arm.c.orig	Mon May  9 14:53:19 2005
+++ arm.c	Fri Aug 12 13:16:23 2005
@@ -944,6 +944,11 @@
       target_flags &= ~ARM_FLAG_APCS_FRAME;
     }
 
+  /* Callee super interworking implies thumb interworking.  Adding
+     this to the flags here simplifies the logic elsewhere.  */
+  if (TARGET_THUMB && TARGET_CALLEE_INTERWORKING)
+      target_flags |= ARM_FLAG_INTERWORK;
+
   /* TARGET_BACKTRACE calls leaf_function_p, which causes a crash if done
      from here where no function is being compiled currently.  */
   if ((target_flags & (THUMB_FLAG_LEAF_BACKTRACE | THUMB_FLAG_BACKTRACE))

I've got now the result

arm-elf-gcc-3.4.4 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 3_4_4_thumb.o

3_4_4_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   .
   register r10 (sl) never been used
   .
  52:	2000      	movs	r0, #0
  54:	bc70      	pop	{r4, r5, r6}
  56:	bc02      	pop	{r1}
  58:	4708      	bx	r1

arm-elf-gcc-4.0.1 -g -Os -fPIC -mthumb -mlittle-endian -mapcs \
      -march=armv4t -mcallee-super-interworking \
      -c progWord.c -o 4_0_1_thumb.o

4_0_1_thumb.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <progWord>:
   0:	e38fc001 	orr	ip, pc, #1	; 0x1
   4:	e12fff1c 	bx	ip

00000008 <.real_start_ofprogWord>:
   8:	b570      	push	{r4, r5, r6, lr}
   a:	4656      	mov	r6, sl
   c:	b440      	push	{r6}
   .
   register r10 (sl) never been used
   .
  56:	2000      	movs	r0, #0
  58:	bc04      	pop	{r2}
  5a:	4692      	mov	sl, r2
  5c:	bc70      	pop	{r4, r5, r6}
  5e:	bc02      	pop	{r1}
  60:	4708      	bx	r1

This is a working version. 
But it is still not optimized.
Should I open the missing otimization within an other bug entry?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (5 preceding siblings ...)
  2005-08-12 11:54 ` th dot r dot klein at web dot de
@ 2005-08-12 12:24 ` pinskia at gcc dot gnu dot org
  2005-08-12 14:58 ` cvs-commit at gcc dot gnu dot org
  2005-08-12 15:52 ` th dot r dot klein at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12 12:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-12 12:24 -------
(In reply to comment #5)
> This is a working version. 
> But it is still not optimized.
> Should I open the missing otimization within an other bug entry?

Yes please.

Since the code is now working code, closing as fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (6 preceding siblings ...)
  2005-08-12 12:24 ` pinskia at gcc dot gnu dot org
@ 2005-08-12 14:58 ` cvs-commit at gcc dot gnu dot org
  2005-08-12 15:52 ` th dot r dot klein at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-12 14:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-12 14:58 -------
Subject: Bug 23250

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	rearnsha@gcc.gnu.org	2005-08-12 14:58:04

Modified files:
	gcc            : ChangeLog 
	gcc/config/arm : arm.c 

Log message:
	PR target/23250
	* arm.c (arm_override_options): Use ARM_FLAG_INTERWORK, not
	MASK_INTERWORK.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.366&r2=2.7592.2.367
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.430.2.3&r2=1.430.2.4



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/23250] [4.0/4.1 regression] 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI
  2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
                   ` (7 preceding siblings ...)
  2005-08-12 14:58 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-12 15:52 ` th dot r dot klein at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: th dot r dot klein at web dot de @ 2005-08-12 15:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From th dot r dot klein at web dot de  2005-08-12 15:52 -------
It's working, Thanks a lot

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23250


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-08-12 15:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-05 16:11 [Bug c/23250] New: 4.0.1 switch -mcallee-super-interworking generating wrong code for ARM7TDMI th dot r dot klein at web dot de
2005-08-05 16:13 ` [Bug target/23250] " pinskia at gcc dot gnu dot org
2005-08-05 16:35 ` [Bug target/23250] [4.0/4.1 regression] " rearnsha at gcc dot gnu dot org
2005-08-11 14:20 ` cvs-commit at gcc dot gnu dot org
2005-08-11 14:33 ` cvs-commit at gcc dot gnu dot org
2005-08-11 14:35 ` rearnsha at gcc dot gnu dot org
2005-08-12 11:54 ` th dot r dot klein at web dot de
2005-08-12 12:24 ` pinskia at gcc dot gnu dot org
2005-08-12 14:58 ` cvs-commit at gcc dot gnu dot org
2005-08-12 15:52 ` th dot r dot klein at web dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).