aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2003-02-06 11:39:45 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-02-06 10:39:45 +0000
commit5fbf0217eade874bc890f993ce8b79c94dbf8fed (patch)
tree1005e2fa3b4d36ab13b78b42acac7af058619423 /gcc
parent8f62128d21de91a372394a84ea4da997d5b35e73 (diff)
downloadgcc-5fbf0217eade874bc890f993ce8b79c94dbf8fed.zip
gcc-5fbf0217eade874bc890f993ce8b79c94dbf8fed.tar.gz
gcc-5fbf0217eade874bc890f993ce8b79c94dbf8fed.tar.bz2
re PR c/9530 (ICE on missing return statement)
PR c/9530 * config/i386/i386.c (ix86_function_ok_for_sibcall): Forbid sibcalls from functions that return a float to functions that don't. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r62480
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.c15
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20030206-1.c14
4 files changed, 32 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea7c3c5..921d0d6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-06 Eric Botcazou <ebotcazou@libertysurf.fr>
+ Richard Henderson <rth@redhat.com>
+
+ PR c/9530
+ * config/i386/i386.c (ix86_function_ok_for_sibcall): Forbid sibcalls
+ from functions that return a float to functions that don't.
+
Thu Feb 6 00:18:38 CET 2003 Jan Hubicka <jh@suse.cz>
* i386.c (x86_inter_unit_moves): New variable.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2c71e1e..23f2494 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1482,11 +1482,9 @@ const struct attribute_spec ix86_attribute_table[] =
{ NULL, 0, 0, false, false, false, NULL }
};
-/* If PIC, we cannot make sibling calls to global functions
- because the PLT requires %ebx live.
- If we are returning floats on the register stack, we cannot make
- sibling calls to functions that return floats. (The stack adjust
- instruction will wind up after the sibcall jump, and not be executed.) */
+/* Decide whether we can make a sibling call to a function. DECL is the
+ declaration of the function being targeted by the call and EXP is the
+ CALL_EXPR representing the call. */
static bool
ix86_function_ok_for_sibcall (decl, exp)
@@ -1501,10 +1499,11 @@ ix86_function_ok_for_sibcall (decl, exp)
/* If we are returning floats on the 80387 register stack, we cannot
make a sibcall from a function that doesn't return a float to a
- function that does; the necessary stack adjustment will not be
- executed. */
+ function that does or, conversely, from a function that does return
+ a float to a function that doesn't; the necessary stack adjustment
+ would not be executed. */
if (STACK_REG_P (ix86_function_value (TREE_TYPE (exp)))
- && ! STACK_REG_P (ix86_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)))))
+ != STACK_REG_P (ix86_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)))))
return false;
/* If this call is indirect, we'll need to be able to use a call-clobbered
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0d39f62..a4f6ad1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-06 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.c-torture/compile/20030206-1.c: New test.
+
2003-02-05 Roger Sayle <roger@eyesopen.com>
* gcc.c-torture/compile/921206-1.c: Rename undeclared function from
diff --git a/gcc/testsuite/gcc.c-torture/compile/20030206-1.c b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c
new file mode 100644
index 0000000..1e0d544
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20030206-1.c
@@ -0,0 +1,14 @@
+/* PR c/9530 */
+/* Contributed by Volker Reichelt. */
+
+/* Verify that the call to 'foo' is not turned
+ into a sibling call. */
+
+void foo(float d);
+
+float bar(float d);
+
+float baz(float d)
+{
+ foo(bar(d));
+}