This is the mail archive of the gcc-prs@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]

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


>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:


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