public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65219] New: GCC wrongly deletes a function which is not completely inlined.
@ 2015-02-26 12:39 bmei at broadcom dot com
2015-02-26 12:47 ` [Bug c/65219] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: bmei at broadcom dot com @ 2015-02-26 12:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65219
Bug ID: 65219
Summary: GCC wrongly deletes a function which is not completely
inlined.
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: bmei at broadcom dot com
Compile the following code with gcc 5.0 (
Target: x86_64-unknown-linux-gnu gcc version 5.0.0 20150226 (experimental)
[trunk revision 143368] (GCC))
~/scratch/install-x86/bin/gcc tst.c -O2 -S
#include <stdio.h>
inline int foo()
{
printf ("HEREEEEEEEEEEEEE\n");
printf ("HEREEEEEEEEEEEEE\n");
printf ("HEREEEEEEEEEEEEE\n");
printf ("HEREEEEEEEEEEEEE\n");
return 0;
}
int bar1 ()
{
return foo();
}
__attribute__((optimize("-funsafe-loop-optimizations")))
int bar2 ()
{
return foo();
}
Resulting assemble code:
.file "tst.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "HEREEEEEEEEEEEEE"
.section .text.unlikely,"ax",@progbits
.LCOLDB1:
.text
.LHOTB1:
.p2align 4,,15
.globl bar1
.type bar1, @function
bar1:
.LFB12:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
movl $.LC0, %edi
call puts
movl $.LC0, %edi
call puts
movl $.LC0, %edi
call puts
movl $.LC0, %edi
call puts
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE12:
.size bar1, .-bar1
.section .text.unlikely
.LCOLDE1:
.text
.LHOTE1:
.section .text.unlikely
.LCOLDB2:
.text
.LHOTB2:
.p2align 4,,-1
.globl bar2
.type bar2, @function
bar2:
.LFB13:
.cfi_startproc
xorl %eax, %eax
jmp foo
.cfi_endproc
.LFE13:
.size bar2, .-bar2
.section .text.unlikely
.LCOLDE2:
.text
.LHOTE2:
.ident "GCC: (GNU) 5.0.0 20150226 (experimental) [trunk revision
143368]"
.section .note.GNU-stack,"",@progbits
The function body of foo is gone, but there is still a call to foo left in
bar2. I did some initial investigation. The bar1 function inline foo in einline
pass. But the bar2 cannot inline it because it has a function-specific optimize
attribute. For some reason the body of foo is just removed anyway.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/65219] GCC wrongly deletes a function which is not completely inlined.
2015-02-26 12:39 [Bug c/65219] New: GCC wrongly deletes a function which is not completely inlined bmei at broadcom dot com
@ 2015-02-26 12:47 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-26 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65219
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is how c99 (now the default) behaves. You are expected to have an
out-of-line copy somewhere.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-26 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 12:39 [Bug c/65219] New: GCC wrongly deletes a function which is not completely inlined bmei at broadcom dot com
2015-02-26 12:47 ` [Bug c/65219] " rguenth at gcc dot gnu.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).