Bug 443583 - gcc produces broken code when -mregparm=3
gcc produces broken code when -mregparm=3
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
9
All Linux
high Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-22 08:08 EDT by Simon Wilkinson
Modified: 2008-06-06 08:42 EDT (History)
2 users (show)

See Also:
Fixed In Version: 4.3.0-8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-06-06 08:42:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 36014 None None None Never

  None (edit)
Description Simon Wilkinson 2008-04-22 08:08:04 EDT
Description of problem:

gcc 4.3.0 as shipped in Fedora 9 pre produces broken code when building un-protoyped functions with 
-mregparm=3

Version-Release number of selected component (if applicable):4.3.0-7


How reproducible:

Build the following test program, with -mregparm=3

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;
}

Steps to Reproduce:
1. Compile the above program with -mregparm=3
2. Run it
  
Actual results:

Program produces output similar to:

Wrong: Got (0x1, 0xbfc96430, 0xbfc96410, (nil), 0x1, 0x2, 0x3, 0x4)

Expected results:

Program produces no output.

Additional info:

It looks like the calling convention is getting screwed up when regparm is being used with defintions 
that aren't fully prototyped (adding a complete prototype for test will fix this problem).
Comment 1 Simon Wilkinson 2008-04-23 07:42:44 EDT
Do you think this will be fixed before the final release of Fedora 9?
Comment 2 Bug Zapper 2008-05-14 05:56:09 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Jakub Jelinek 2008-06-06 08:42:08 EDT
This was fixed in 4.3.0-8.

Note You need to log in before you can comment on or make changes to this bug.