c/8722: nmrpsa_problem

bx22@cornell.edu bx22@cornell.edu
Tue Nov 26 10:58:00 GMT 2002

>Number:         8722
>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:36:00 PST 2002
>Originator:     Bosong Xiang
>Release:        Cygwin DLL 1.3.15-1
Windows XP;  1 GB RAM; 60 GB Hard Disk; 1.8 GHz.
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.
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.
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;

  CYCS cycs;


More information about the Gcc-bugs mailing list