This is the mail archive of the gcc-bugs@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/8721: nmrpsa_problem


>Number:         8721
>Category:       c
>Synopsis:       nmrpsa_problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 10:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bosong Xiang
>Release:        Cygwin DLL 1.3.15-1
>Organization:
>Environment:
Windows XP;  1 GB RAM; 60 GB Hard Disk; 1.8 GHz.
>Description:
The attached source file is a part of my original program. When the number 187 after the "CYC cys[" is changed to larger than 189, the result of the a.exe after the gcc compilation is "Segmentation fault".  When the number is 188 or 189, a.exe doesn't print anything.  When the number is 187 or smaller, a.exe produces the expected "Good!".

The same program was successfully compiled and tested on SGI with a C compiler and SUN with gcc compilers. Both of them had much less memory than the PC I am using right now. I would like to know how to make it work when the above mentioned number is larger than 189.
>How-To-Repeat:
Just compile the attached file with gcc and run while the number 187 after "CYC cyc[" is changed into another number mentioned in the Description.
>Fix:
NA
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="nmrpsa_problem.c"
Content-Disposition: inline; filename="nmrpsa_problem.c"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct phase {  
  char name[200];  
  char a[12];    
};
typedef struct phase PHA;

struct cycle {  
  int N;          
  PHA pha[52];  
};
typedef struct cycle CYC;

struct cycles {  
  int N;	    
  CYC cyc[187]; //<188:Good; 188,189:No print; >189:Segmentation fault.
};
typedef struct cycles CYCS;

main()
{
  CYCS cycs;

  printf("Good!\n");
}


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