public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness
@ 2009-02-19 11:03 jakub at gcc dot gnu dot org
2009-02-19 11:17 ` [Bug target/39240] [4.2/4.3/4.4 Regression] " jakub at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-19 11:03 UTC (permalink / raw)
To: gcc-bugs
extern void abort (void);
__attribute__ ((noinline))
static int foo1 (int x)
{
return x;
}
__attribute__ ((noinline))
unsigned int bar1 (int x)
{
return foo1 (x + 6);
}
unsigned long l1 = (unsigned int) -4;
__attribute__ ((noinline))
static short int foo2 (int x)
{
return x;
}
__attribute__ ((noinline))
unsigned short int bar2 (int x)
{
return foo2 (x + 6);
}
unsigned long l2 = (unsigned short int) -4;
__attribute__ ((noinline))
static signed char foo3 (int x)
{
return x;
}
__attribute__ ((noinline))
unsigned char bar3 (int x)
{
return foo3 (x + 6);
}
unsigned long l3 = (unsigned char) -4;
__attribute__ ((noinline))
static unsigned int foo4 (int x)
{
return x;
}
__attribute__ ((noinline))
int bar4 (int x)
{
return foo4 (x + 6);
}
unsigned long l4 = (int) -4;
__attribute__ ((noinline))
static unsigned short int foo5 (int x)
{
return x;
}
__attribute__ ((noinline))
short int bar5 (int x)
{
return foo5 (x + 6);
}
unsigned long l5 = (short int) -4;
__attribute__ ((noinline))
static unsigned char foo6 (int x)
{
return x;
}
__attribute__ ((noinline))
signed char bar6 (int x)
{
return foo6 (x + 6);
}
unsigned long l6 = (signed char) -4;
int
main (void)
{
if (bar1 (-10) != l1)
abort ();
if (bar2 (-10) != l2)
abort ();
if (bar3 (-10) != l3)
abort ();
if (bar4 (-10) != l4)
abort ();
if (bar5 (-10) != l5)
abort ();
if (bar6 (-10) != l6)
abort ();
return 0;
}
aborts on powerpc64-linux, both -m32 and -m64, at -O2 and higher (whenever
-foptimize-sibling-calls is in effect). In 4.4 this causes a Linux kernel
miscompilation on ppc64, see https://bugzilla.redhat.com/show_bug.cgi?id=485067
so to some extent it could be considered a regression, that said, the testcase
I'm providing here fails with 4.1, 4.3 as well as trunk.
As the psABI says that integral return values are passed in r3 and
zero-extended/sign-extended as needed to 64-bits (32-bits for 32-bit psABI),
obviously integral types with smaller precision than that need to have the same
signedness between caller and tail callee.
Just wonder whether this is something that should be fixed in rs6000
function_ok_for_sibcall hook (would probably be less risky for 4.4 and release
branches) or whether calls.c should do that generically.
--
Summary: Invalid sibcall optimization with promoted return types
and differing signedness
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3/4.4 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
@ 2009-02-19 11:17 ` jakub at gcc dot gnu dot org
2009-02-19 12:45 ` jakub at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-19 11:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2009-02-19 11:16 -------
Ah, it is a regression from 3.4.x.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Priority|P3 |P1
Last reconfirmed|0000-00-00 00:00:00 |2009-02-19 11:16:54
date| |
Summary|Invalid sibcall optimization|[4.2/4.3/4.4 Regression]
|with promoted return types |Invalid sibcall optimization
|and differing signedness |with promoted return types
| |and differing signedness
Target Milestone|--- |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3/4.4 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
2009-02-19 11:17 ` [Bug target/39240] [4.2/4.3/4.4 Regression] " jakub at gcc dot gnu dot org
@ 2009-02-19 12:45 ` jakub at gcc dot gnu dot org
2009-02-20 10:13 ` jakub at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-19 12:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2009-02-19 12:45 -------
Created an attachment (id=17328)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17328&action=view)
gcc44-pr39240.patch
Patch I'm going to bootstrap/regtest.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3/4.4 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
2009-02-19 11:17 ` [Bug target/39240] [4.2/4.3/4.4 Regression] " jakub at gcc dot gnu dot org
2009-02-19 12:45 ` jakub at gcc dot gnu dot org
@ 2009-02-20 10:13 ` jakub at gcc dot gnu dot org
2009-02-20 10:19 ` [Bug target/39240] [4.2/4.3 " jakub at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-20 10:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2009-02-20 10:13 -------
Subject: Bug 39240
Author: jakub
Date: Fri Feb 20 10:13:17 2009
New Revision: 144316
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144316
Log:
PR target/39240
* calls.c (expand_call): Clear try_tail_call if caller and callee
disagree in promotion of function return value.
* gcc.c-torture/execute/pr39240.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr39240.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/calls.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-02-20 10:13 ` jakub at gcc dot gnu dot org
@ 2009-02-20 10:19 ` jakub at gcc dot gnu dot org
2009-03-02 1:28 ` cnstar9988 at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-20 10:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2009-02-20 10:19 -------
Fixed so far on the trunk.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.3.3
Known to work| |4.4.0
Summary|[4.2/4.3/4.4 Regression] |[4.2/4.3 Regression] Invalid
|Invalid sibcall optimization|sibcall optimization with
|with promoted return types |promoted return types and
|and differing signedness |differing signedness
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-02-20 10:19 ` [Bug target/39240] [4.2/4.3 " jakub at gcc dot gnu dot org
@ 2009-03-02 1:28 ` cnstar9988 at gmail dot com
2009-03-13 22:53 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cnstar9988 at gmail dot com @ 2009-03-02 1:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from cnstar9988 at gmail dot com 2009-03-02 01:28 -------
ping 4.3.4
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.2/4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-03-02 1:28 ` cnstar9988 at gmail dot com
@ 2009-03-13 22:53 ` rguenth at gcc dot gnu dot org
2009-03-31 21:12 ` [Bug target/39240] [4.3 " jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-03-13 22:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2009-03-13 22:53 -------
Lowering priority. Not a regression on the branch.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P1 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-03-13 22:53 ` rguenth at gcc dot gnu dot org
@ 2009-03-31 21:12 ` jsm28 at gcc dot gnu dot org
2009-06-18 14:46 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 21:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jsm28 at gcc dot gnu dot org 2009-03-31 21:10 -------
Closing 4.2 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.2/4.3 Regression] Invalid|[4.3 Regression] Invalid
|sibcall optimization with |sibcall optimization with
|promoted return types and |promoted return types and
|differing signedness |differing signedness
Target Milestone|4.2.5 |4.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-03-31 21:12 ` [Bug target/39240] [4.3 " jsm28 at gcc dot gnu dot org
@ 2009-06-18 14:46 ` rguenth at gcc dot gnu dot org
2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-18 14:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenth at gcc dot gnu dot org 2009-06-18 14:45 -------
Testing backport.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|jakub at gcc dot gnu dot org|rguenth at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2009-06-19 16:14 -------
Subject: Bug 39240
Author: rguenth
Date: Fri Jun 19 16:13:53 2009
New Revision: 148717
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148717
Log:
2009-06-19 Richard Guenther <rguenther@suse.de>
Backport from mainline:
2009-02-20 Jakub Jelinek <jakub@redhat.com>
PR target/39240
* calls.c (expand_call): Clear try_tail_call if caller and callee
disagree in promotion of function return value.
* gcc.c-torture/execute/pr39240.c: New test.
Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr39240.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/calls.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/39240] [4.3 Regression] Invalid sibcall optimization with promoted return types and differing signedness
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
` (7 preceding siblings ...)
2009-06-18 14:46 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2009-06-19 16:14 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to work|4.4.0 |4.3.4 4.4.0
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39240
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-06-19 16:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-19 11:03 [Bug target/39240] New: Invalid sibcall optimization with promoted return types and differing signedness jakub at gcc dot gnu dot org
2009-02-19 11:17 ` [Bug target/39240] [4.2/4.3/4.4 Regression] " jakub at gcc dot gnu dot org
2009-02-19 12:45 ` jakub at gcc dot gnu dot org
2009-02-20 10:13 ` jakub at gcc dot gnu dot org
2009-02-20 10:19 ` [Bug target/39240] [4.2/4.3 " jakub at gcc dot gnu dot org
2009-03-02 1:28 ` cnstar9988 at gmail dot com
2009-03-13 22:53 ` rguenth at gcc dot gnu dot org
2009-03-31 21:12 ` [Bug target/39240] [4.3 " jsm28 at gcc dot gnu dot org
2009-06-18 14:46 ` rguenth at gcc dot gnu dot org
2009-06-19 16:14 ` rguenth at gcc dot gnu dot org
2009-06-19 16:14 ` rguenth 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).