C9006000: C1001: grammar.c, Line 140

ID Number: Q62664

6.00 6.00a | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 fixlist6.00a

Summary:

SYMPTOMS

The following sample code generates an internal compiler error

(ICE) when compiled with optimizations disabled (/Od), with global

register optimization (/Oe), or with loop optimization (/Ol):

file.c(38) : fatal error C1001: Internal Compiler Error

(compiler file '../grammar.c', line 140)

Contact Microsoft Product Support Services

The ICE occurs only under compact or large model.

RESOLUTION

The following are separate, valid workarounds for this internal

compiler error:

1. Compile with a memory model other than large or compact.

2. Compile with default optimizations (/Ot).

3. Uncomment the pragmas to optimize for time.

4. Initialize the current_page variable.

5. Compile with the /qc option to run the QuickC Compiler.

STATUS

Microsoft has confirmed this to be a problem in the C Compiler

version 6.0. This problem was corrected in version 6.0a.

More Information:

Sample Code

-----------

/* Compile options needed: /c /Od /AL

*/

// #pragma optimize ( "t", on ) // Uncomment this to correct ICE

#define TOTAL_LEGS 12

#define TOTAL_PAGES 2

#include <memory.h>

struct leg {

int fix_index;

char id[6];

double latitude, longitude;

} ;

struct page {

int index;

double x2, x3, y2, y3 ;

} ;

struct leg trip_legs [ TOTAL_PAGES ] [ TOTAL_PAGES + 1 ] ;

struct page pages [ TOTAL_PAGES ] ;

int current_page; // Or, initialize this to make ICE disappear.

void delete_wp1 ( int index ) ;

void delete_wp1 ( int index )

{

current_page = 1;

if ( index > 0 )

{ // ICE occurs on following line.

pages[current_page].x2 =

trip_legs [current_page] [index -1].longitude;

pages[current_page].y2 =

trip_legs[current_page][index - 1].latitude;

}

}

Additional reference words: 6.00 6.00a