This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/17653] New: different parameter passing methods not checked on function pointer assignments
- From: "jbeulich at novell dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Sep 2004 15:06:57 -0000
- Subject: [Bug target/17653] New: different parameter passing methods not checked on function pointer assignments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In order to help the developer, checks for attribute consistency respective
regparm, stdcall, or fastcall (for i386, for other architectures this would
apply similarly if they support attributes of similar functionality) should be
added. Identically, this would be good for architecture-independent function
attributes like pure. Specifically, the example below should not compile without
any diagnostic:
typedef __attribute__((__regparm__(0))) int noregs_t(int, int);
typedef __attribute__((__regparm__(1))) int onereg_t(int, int);
typedef __attribute__((__regparm__(2))) int tworegs_t(int, int);
noregs_t noregs;
onereg_t onereg;
tworegs_t tworegs;
noregs_t*noregs_a[] = {noregs, onereg, tworegs};
onereg_t*onereg_a[] = {noregs, onereg, tworegs};
tworegs_t*tworegs_a[] = {noregs, onereg, tworegs};
int test(int i, int x, int y) {
return noregs_a[i](x, y) * -onereg_a[i](x, y) + tworegs_a[i](x, y);
}
--
Summary: different parameter passing methods not checked on
function pointer assignments
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jbeulich at novell dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-suse-linux
GCC host triplet: i686-suse-linux
GCC target triplet: i686-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17653