This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Q: Sibling calls
- To: Jakub Jelinek <jakub at redhat dot com>
- Subject: Q: Sibling calls
- From: Peter Nenzén <qinxpen at ks dot ericsson dot se>
- Date: Fri, 24 Mar 2000 15:52:39 +0100
- CC: gcc-patches at gcc dot gnu dot org
- Organization: Ericsson
- References: <20000324151744.C555@mff.cuni.cz>
Hi!
With the new patch for sibcalls on sparc this program with void
functions works fine:
+void one(int x);
+void two(int x);
+
+int main(void)
+{
+ one(0);
+}
+
+void one(int x)
+{
+ printf("one %i\n",x);
+ two(x+1);
+}
+
+void two(int x)
+{
+ printf("two %i\n",x);
+ one(x+1);
+}
But why doesn't this one work? It causes a segmentation fault.
+int main(void)
+{
+ one(0);
+}
+
+int one(int x)
+{
+ printf("one %i\n",x);
+ two(x+1);
+}
+
+int two(int x)
+{
+ printf("two %i\n",x);
+ one(x+1);
+}
Regards,
Peter and Anders