[Bug target/17653] New: different parameter passing methods not checked on function pointer assignments

jbeulich at novell dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 24 15:06:00 GMT 2004


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



More information about the Gcc-bugs mailing list