public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2
@ 2004-04-25 14:48 sugioka at itonet dot co dot jp
  2004-04-25 15:32 ` [Bug optimization/15130] " sugioka at itonet dot co dot jp
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: sugioka at itonet dot co dot jp @ 2004-04-25 14:48 UTC (permalink / raw)
  To: gcc-bugs

The attached code wrongly compiles with -O2.
It correctly compiles with -O.

In this case, incorrect value is loaded to r7 (4th argument)
before calling function xxxx.

-- 
           Summary: [3.3/3.4][sh4-linux] miscompilation with -O2
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: sh4-unknown-linux-gnu
GCC target triplet: sh4-unknown-linux-gnu


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
  2004-04-25 15:32 ` [Bug optimization/15130] " sugioka at itonet dot co dot jp
@ 2004-04-25 15:32 ` pinskia at gcc dot gnu dot org
  2004-05-11 20:37 ` cvs-commit at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-25 15:32 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|optimization                |target
           Keywords|                            |wrong-code


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


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

* [Bug optimization/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
@ 2004-04-25 15:32 ` sugioka at itonet dot co dot jp
  2004-04-25 15:32 ` [Bug target/15130] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sugioka at itonet dot co dot jp @ 2004-04-25 15:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sugioka at itonet dot co dot jp  2004-04-25 14:42 -------
Created an attachment (id=6160)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6160&action=view)
test case for this bug report

To reproduce on sh4-linux host, just do compile with -O2 and run.

$ gcc -v -O2 bug.i && ./a.out
Reading specs from /usr/lib/gcc/sh4-linux/3.4.0/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/u
sr/share/info --datadir=/usr/share --target=sh4-linux --host=sh4-linux
--build=i
686-pc-linux-gnu --with-system-zlib --with-gxx-include-dir=/usr/include/g++-v3
-
-disable-checking --enable-shared --enable-__cxa_atexit --enable-c99
--enable-th
reads=posix --enable-long-long --disable-symvers --enable-languages=c,c++
Thread model: posix
gcc version 3.4.0
 /usr/libexec/gcc/sh4-linux/3.4.0/cc1 -fpreprocessed bug.i -quiet -dumpbase
bug.
i -auxbase bug -O2 -version -o /tmp/ccZUgRia.s
GNU C version 3.4.0 (sh4-linux)
	compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=38 --param ggc-min-heapsize=15479
 as -little -o /tmp/ccSnfOl1.o /tmp/ccZUgRia.s
 /usr/libexec/gcc/sh4-linux/3.4.0/collect2 --eh-frame-hdr -m shlelf_linux
-dynam
ic-linker /lib/ld-linux.so.2 /usr/lib/gcc/sh4-linux/3.4.0/../../../crt1.o
/usr/l
ib/gcc/sh4-linux/3.4.0/../../../crti.o /usr/lib/gcc/sh4-linux/3.4.0/crtbegin.o
-
L/usr/lib/gcc/sh4-linux/3.4.0 -L/usr/lib/gcc/sh4-linux/3.4.0
-L/usr/lib/gcc/sh4-
linux/3.4.0/../../../../sh4-linux/lib -L/usr/lib/gcc/sh4-linux/3.4.0/../../..
/t
mp/ccSnfOl1.o -lgcc -lgcc_eh -rpath-link /lib:/usr/lib -lc -lgcc -lgcc_eh
/usr/l
ib/gcc/sh4-linux/3.4.0/crtend.o /usr/lib/gcc/sh4-linux/3.4.0/../../../crtn.o
Compiler BUG. 0x10c should be 0x4006a0


-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
  2004-04-25 15:32 ` [Bug optimization/15130] " sugioka at itonet dot co dot jp
  2004-04-25 15:32 ` [Bug target/15130] " pinskia at gcc dot gnu dot org
@ 2004-05-11 20:37 ` cvs-commit at gcc dot gnu dot org
  2004-05-11 20:57 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-11 20:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-10 23:25 -------
Subject: Bug 15130

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kkojima@gcc.gnu.org	2004-05-10 23:25:13

Modified files:
	gcc            : ChangeLog 
	gcc/config/sh  : sh-protos.h sh.c sh.md 

Log message:
	PR target/15130
	* config/sh/sh-protos.h (sh_expand_epilogue): Change prototype.
	* config/sh/sh.c (output_stack_adjust): Take the sibcall epilogue
	into account.  Compute the correct number of general registers
	for the return value.  Generate a special push/pop sequence when
	failing to get a temporary register for non SHmedia epilogue.
	(sh_expand_epilogue): Add an argument to show whether it's for
	sibcall or not.  Set the 3rd argument of output_stack_adjust to
	-1 if needed.
	(sh_need_epilogue): Call sh_expand_epilogue with 0.
	* config/sh/sh.md (sibcall_epilogue): Call sh_expand_epilogue
	with 1.
	(epilogue): Call sh_expand_epilogue with 0.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3620&r2=2.3621
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh-protos.h.diff?cvsroot=gcc&r1=1.54&r2=1.55
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.267&r2=1.268
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&r1=1.170&r2=1.171



-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (2 preceding siblings ...)
  2004-05-11 20:37 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-11 20:57 ` cvs-commit at gcc dot gnu dot org
  2004-05-11 21:00 ` kkojima at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-11 20:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-10 23:47 -------
Subject: Bug 15130

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	kkojima@gcc.gnu.org	2004-05-10 23:47:49

Modified files:
	gcc            : ChangeLog 
	gcc/config/sh  : sh-protos.h sh.c sh.md 

Log message:
	PR target/15130
	Backport from mainline:
	
	* config/sh/sh-protos.h (sh_expand_epilogue): Change prototype.
	* config/sh/sh.c (output_stack_adjust): Take the sibcall epilogue
	into account.  Compute the correct number of general registers
	for the return value.  Generate a special push/pop sequence when
	failing to get a temporary register for non SHmedia epilogue.
	(sh_expand_epilogue): Add an argument to show whether it's for
	sibcall or not.  Set the 3rd argument of output_stack_adjust to
	-1 if needed.
	(sh_need_epilogue): Call sh_expand_epilogue with 0.
	* config/sh/sh.md (sibcall_epilogue): Call sh_expand_epilogue
	with 1.
	(epilogue): Call sh_expand_epilogue with 0.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.439&r2=2.2326.2.440
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.53&r2=1.53.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.247.2.5&r2=1.247.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.165.4.1&r2=1.165.4.2



-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (3 preceding siblings ...)
  2004-05-11 20:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-11 21:00 ` kkojima at gcc dot gnu dot org
  2004-05-11 21:01 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2004-05-11 21:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kkojima at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (4 preceding siblings ...)
  2004-05-11 21:00 ` kkojima at gcc dot gnu dot org
@ 2004-05-11 21:01 ` gdr at integrable-solutions dot net
  2004-05-12  3:27 ` kkojima at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-05-11 21:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-05-11 00:18 -------
Subject: Re:  [3.3/3.4][sh4-linux] miscompilation with -O2

"kkojima at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| -- 
|            What    |Removed                     |Added
| ----------------------------------------------------------------------------
|          AssignedTo|unassigned at gcc dot gnu   |kkojima at gcc dot gnu dot
|                    |dot org                     |org
|              Status|UNCONFIRMED                 |ASSIGNED

You may take care of gcc-3_3-branch too.


-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (5 preceding siblings ...)
  2004-05-11 21:01 ` gdr at integrable-solutions dot net
@ 2004-05-12  3:27 ` kkojima at gcc dot gnu dot org
  2004-05-14  4:07 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2004-05-12  3:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kkojima at gcc dot gnu dot org  2004-05-11 00:54 -------
Sure.  I feel that the full backport of the patch against mainline/3.4
to 3.3 is a little invasive because the affected part of code is fairly
different between 3.3 and 3.4.  I'll come up with a patch for 3.3 and
talk with port maintainers about it.


-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (6 preceding siblings ...)
  2004-05-12  3:27 ` kkojima at gcc dot gnu dot org
@ 2004-05-14  4:07 ` cvs-commit at gcc dot gnu dot org
  2004-05-14  7:52 ` kkojima at gcc dot gnu dot org
  2004-07-10  1:00 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-14  4:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-13 14:28 -------
Subject: Bug 15130

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	kkojima@gcc.gnu.org	2004-05-13 14:28:36

Modified files:
	gcc            : ChangeLog 
	gcc/config/sh  : sh-protos.h sh.c sh.md 

Log message:
	PR target/15130
	* config/sh/sh-protos.h (sh_expand_epilogue): Change prototype.
	* config/sh/sh.c (output_stack_adjust): Generate a special
	push/pop sequence when failing to get a temporary register for
	non SHmedia epilogue.
	(sh_expand_epilogue): Add an argument to show whether it's for
	sibcall or not.  Take the sibcall epilogue into account.
	(sh_need_epilogue): Call sh_expand_epilogue with 0.
	* config/sh/sh.md (sibcall_epilogue): Call sh_expand_epilogue
	with 1.
	(epilogue): Call sh_expand_epilogue with 0.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.978&r2=1.16114.2.979
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.34.2.2&r2=1.34.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.188.2.9&r2=1.188.2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.133.2.2&r2=1.133.2.3



-- 


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (7 preceding siblings ...)
  2004-05-14  4:07 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-14  7:52 ` kkojima at gcc dot gnu dot org
  2004-07-10  1:00 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2004-05-14  7:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kkojima at gcc dot gnu dot org  2004-05-13 14:34 -------
Fixed on 3.3/3.4/mainline.

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


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


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

* [Bug target/15130] [3.3/3.4][sh4-linux] miscompilation with -O2
  2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
                   ` (8 preceding siblings ...)
  2004-05-14  7:52 ` kkojima at gcc dot gnu dot org
@ 2004-07-10  1:00 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-10  1:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.3.5


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


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

end of thread, other threads:[~2004-07-10  1:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-25 14:48 [Bug optimization/15130] New: [3.3/3.4][sh4-linux] miscompilation with -O2 sugioka at itonet dot co dot jp
2004-04-25 15:32 ` [Bug optimization/15130] " sugioka at itonet dot co dot jp
2004-04-25 15:32 ` [Bug target/15130] " pinskia at gcc dot gnu dot org
2004-05-11 20:37 ` cvs-commit at gcc dot gnu dot org
2004-05-11 20:57 ` cvs-commit at gcc dot gnu dot org
2004-05-11 21:00 ` kkojima at gcc dot gnu dot org
2004-05-11 21:01 ` gdr at integrable-solutions dot net
2004-05-12  3:27 ` kkojima at gcc dot gnu dot org
2004-05-14  4:07 ` cvs-commit at gcc dot gnu dot org
2004-05-14  7:52 ` kkojima at gcc dot gnu dot org
2004-07-10  1:00 ` pinskia at gcc dot gnu dot org

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).