This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/12270] New: GCC does not honour __attribute__((regparm(3))) when calling function via pointer in array
- From: "mikulas at artax dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Sep 2003 22:22:56 -0000
- Subject: [Bug target/12270] New: GCC does not honour __attribute__((regparm(3))) when calling function via pointer in array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12270
Summary: GCC does not honour __attribute__((regparm(3))) when
calling function via pointer in array
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu
The attached file demonstrates a bug in gcc calling conventions. When calling
function via pointer in array, gcc calls it with normal "regparm(0)" convention
instead of regparm(3) convention that was specified as an attribute for array
type. Bug is present in gcc 3.3.1. Bug does not seem to be present in gcc 3.0.4
and gcc 3.4.
Compile the file (without optimization) and run it. It exits on abort. Look at
assembler at function b. It calls array element with arguments on stack.