[Bug c/25499] New: regression: bogus 'defined but not used' warning
static int foo(void) { return 7; } int main() { int foo(void); return foo(); } [EMAIL PROTECTED]:/tmp$ /usr/bin/gcc-3.4 -Wall -c foo.c foo.c:1: warning: 'foo' defined but not used [EMAIL PROTECTED]:/tmp$ /usr/bin/gcc-3.4 --version gcc-3.4 (GCC) 3.4.5 (Debian 3.4.5-1) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED]:/tmp$ /usr/bin/gcc-3.2 -Wall -c foo.c [EMAIL PROTECTED]:/tmp$ /usr/bin/gcc-3.3 -Wall -c foo.c [EMAIL PROTECTED]:/tmp$ /usr/bin/gcc-4.0 -Wall -c foo.c [EMAIL PROTECTED]:/tmp$ -- Summary: regression: bogus 'defined but not used' warning Product: gcc Version: 3.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rusty at rustcorp dot com dot au GCC host triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25499
[Bug c/35728] New: Inlined function via function pointer emitted unnecessarily
>From http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9079 now we get: .file "foo.c" .section.rodata.str1.1,"aMS",@progbits,1 .LC0: .string "Hello World.\n" .text .p2align 4,,15 .type funk, @function funk: pushl %ebp movl$.LC0, %eax movl%esp, %ebp popl%ebp ret .size funk, .-funk .section.rodata.str1.1 .LC1: .string "Hello World." .text .p2align 4,,15 .globl main .type main, @function main: leal4(%esp), %ecx andl$-16, %esp pushl -4(%ecx) pushl %ebp movl%esp, %ebp pushl %ecx subl$4, %esp movl$.LC1, (%esp) callputs addl$4, %esp popl%ecx popl%ebp leal-4(%ecx), %esp ret .size main, .-main .ident "GCC: (Ubuntu 4.3.0-1ubuntu1) 4.3.0" .section.note.GNU-stack,"",@progbits Note funk (a static function) is unused, and successfully inlined, but still omitted. Replicated on powerpc as well, so not x86-specific. -- Summary: Inlined function via function pointer emitted unnecessarily Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rusty at rustcorp dot com dot au GCC build triplet: i386-linux-gnu-gcc-4.1 GCC host triplet: i386-linux-gnu-gcc-4.1 GCC target triplet: i386-linux-gnu-gcc-4.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35728
[Bug tree-optimization/9079] [tree-ssa] Inline constant function pointers
--- Comment #16 from rusty at rustcorp dot com dot au 2008-03-28 02:38 --- OK, this is fixed in gcc 4.3 (woot!), but the unused "funk" is still omitted. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35728 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9079
[Bug c/32751] New: Missed optimization with function ptrs even when inline
I expect "one" not to be emitted when compiling this with -O3: === cut here === static inline unsigned long one(void) { return 1; } static inline unsigned long call(unsigned long (*fn)(void)) { return fn(); } int test_call(void) { return call(one); } === cut here === .file "foo.c" .text .p2align 4,,15 .type one, @function one: pushl %ebp movl$1, %eax movl%esp, %ebp popl%ebp ret .size one, .-one .p2align 4,,15 .globl test_call .type test_call, @function test_call: pushl %ebp movl%esp, %ebp popl%ebp jmp one .size test_call, .-test_call .ident "GCC: (GNU) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)" .section.note.GNU-stack,"",@progbits === cut here === The lack of this optimization means that it's inefficient to write generic routines (eg. see include/linux/rbtree.h in the Linux sources). Thanks, Rusty. -- Summary: Missed optimization with function ptrs even when inline Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rusty at rustcorp dot com dot au GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32751
[Bug c/44257] New: typeof(*(struct undefined *)) fails to compile
struct foo; typeof(struct foo) *p; // This is fine. typeof(*p) *p2; // foo.c:5: error: dereferencing pointer to incomplete type This is important, because AFAICT the only way to declare a const pointer for a given type is: "const typeof(*p) *" which doesn't work if p is a pointer to an undefined struct :( -- Summary: typeof(*(struct undefined *)) fails to compile Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rusty at rustcorp dot com dot au http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44257