c/10813: Stack bug for functions with return value and parameter pointer

powerstat@web.de powerstat@web.de
Fri May 16 05:56:00 GMT 2003


>Number:         10813
>Category:       c
>Synopsis:       Stack bug for functions with return value and parameter pointer
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 16 04:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     powerstat@web.de
>Release:        unknown-1.0
>Organization:
>Environment:
Windows 2000 with djgpp installation, gcc version 3.2.3
>Description:
The following (shortened) code:

#include <stdio.h>

 unsigned short countFixDateInRange(unsigned short startday, unsigned short startmonth, long startyear,                         unsigned short endday, unsigned short endmonth, long endyear, unsigned short day, unsigned short month, long *const year)
  {
   *year = 2003;
   return(0);
  }

int main(void)
 {
  long year = -1;
  unsigned short daycount = countFixDateInRange(startday,startmonth,startyear,endday,endmonth,endyear,1,5,&year);
printf("%hu\n",daycount);
printf("%ld\n",year);
 }

this should output:
0
2003

but it shows me:

2003
2003

when I comment the "year" parameter out - the return value is correct. - Looks like a stack problem?
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list