[Bug target/12270] New: GCC does not honour __attribute__((regparm(3))) when calling function via pointer in array

mikulas at artax dot karlin dot mff dot cuni dot cz gcc-bugzilla@gcc.gnu.org
Sun Sep 14 00:37:00 GMT 2003


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.



More information about the Gcc-bugs mailing list