Bug 443583 - gcc produces broken code when -mregparm=3
Summary: gcc produces broken code when -mregparm=3
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 9
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-22 12:08 UTC by Simon Wilkinson
Modified: 2008-06-06 12:42 UTC (History)
2 users (show)

Fixed In Version: 4.3.0-8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-06 12:42:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 36014 0 None None None Never

Description Simon Wilkinson 2008-04-22 12:08:04 UTC
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 11:42:44 UTC
Do you think this will be fixed before the final release of Fedora 9?

Comment 2 Bug Zapper 2008-05-14 09:56:09 UTC
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 12:42:08 UTC
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.