Bug 36014 - gcc produces broken code when -mregparm=3
Summary: gcc produces broken code when -mregparm=3
Status: RESOLVED DUPLICATE of bug 36015
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-22 16:08 UTC by Simon Wilkinson
Modified: 2008-04-22 16:15 UTC (History)
2 users (show)

See Also:
Host: i386-redhat-linux
Target: i386-redhat-linux
Build: i386-redhat-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Wilkinson 2008-04-22 16:08:44 UTC
gcc produces broken function entry code when building code with incomplete prototypes, and -mregparm=3.

The following test case illustrates the problem ...

extern int printf (const char *, ...) __attribute__ ((regparm(0)));

static int test();

int main(int argc, char **argv) {

  test(0,1,2,3,4,5,6,7);
}

static int test(int a, int b, int c, int d, int e, int f, int g, int h) {
  if (a != 0 || b != 1 || c != 2) {
    printf("Wrong: Got (%p, %p, %p, %p, %p, %p, %p, %p)", a, b, c, d, e, f, g, h);
  }

  return 1;
}

When built with gcc -mregparm=3, and run, this produces:

Wrong: Got (0x1, 0xbfc96430, 0xbfc96410, (nil), 0x1, 0x2, 0x3, 0x4)
Comment 1 Jakub Jelinek 2008-04-22 16:15:54 UTC

*** This bug has been marked as a duplicate of 36015 ***