This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/12329] New: x86: local function declared with attribute((regparm(3))) gets corrupted parent frame pointer


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12329

           Summary: x86: local function declared with
                    attribute((regparm(3))) gets corrupted parent frame
                    pointer
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        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-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

Since the parent function's frame pointer is passed in ECX, that register should
not be available for argument passing. However, the third parameter is assigned
to ECX, and thus the callee's assumption of (also) finding the frame pointer
there breaks.

int test(int i) {
	static int __attribute__((__regparm__(3))) stest(int j, int k, int l) {
		return i + j + k + l;
	}
	return stest(i, i, i) * i;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]