Bug 68677 - Sibcall doesn't work on function with no return
Summary: Sibcall doesn't work on function with no return
Status: RESOLVED DUPLICATE of bug 10837
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-03 14:53 UTC by H.J. Lu
Modified: 2015-12-03 17:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-12-03 14:53:12 UTC
[hjl@gnu-6 tmp]$ cat x.c
extern void bar (void) __attribute__ ((noreturn));

void
foo (void)
{
  bar ();
}
[hjl@gnu-6 tmp]$ gcc -S x.c -O3
[hjl@gnu-6 tmp]$ cat x.s
	.file	"x.c"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB0:
	.text
.LHOTB0:
	.p2align 4,,15
	.globl	foo
	.type	foo, @function
foo:
.LFB0:
	.cfi_startproc
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	bar
	.cfi_endproc
.LFE0:
	.size	foo, .-foo
	.section	.text.unlikely
.LCOLDE0:
	.text
.LHOTE0:
	.ident	"GCC: (GNU) 5.2.1 20151104 (Red Hat 5.2.1-4)"
	.section	.note.GNU-stack,"",@progbits
[hjl@gnu-6 tmp]$
Comment 1 Richard Biener 2015-12-03 15:09:33 UTC
It's a feature for debugging of abort()-like calls.  And in this case it's
a tailcall as well (which is probably what you are after).
Comment 2 Jakub Jelinek 2015-12-03 15:25:59 UTC
I believe this is intentional and has been discussed in the past.
E.g. one of the often used noreturn functions is abort and its callers, in that case we better not sibcall to that, as it will be harder to find out where exactly the code aborted.
Also, often not doing a sibcall is shorter, you can stay where you were with the stack pointer, while for sibcall you'd bump the stack pointer first.
Comment 3 H.J. Lu 2015-12-03 15:59:46 UTC
Won't fix then.
Comment 4 Andrew Pinski 2015-12-03 17:54:56 UTC
This is the second time in less than 6 months you filed this bug, see PR 67327.
Anyways this is a dup of bug 10837 really.

*** This bug has been marked as a duplicate of bug 10837 ***