[Bug c/29247] New: ABI not considered when checking if function pointers are compatible
acahalan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 27 02:33:00 GMT 2006
A warning is missing. When functions differ by number of args,
a warning gets produced. None is provided for an ABI difference.
foo 0 $ cat mismatch.c
#ifdef TWO
typedef int(*fn_t)(int a, int b)__attribute__(( regparm(0) ));
#else
typedef int(*fn_t)(int a, int b, int c)__attribute__(( regparm(0) ));
#endif
int foo(fn_t fn);
int bar(int a, int b, int c) __attribute__(( regparm(3) ));
int baz(void){
return foo(bar);
}
foo 0 $ gcc -W -Wall -O2 -c mismatch.c
foo 0 $ gcc -W -Wall -O2 -DTWO -c mismatch.c
mismatch.c: In function ÂbazÂ:
mismatch.c:9: warning: passing argument 1 of Âfoo from incompatible pointer
type
foo 0 $
--
Summary: ABI not considered when checking if function pointers
are compatible
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: acahalan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29247
More information about the Gcc-bugs
mailing list