By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,028 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,028 IT Pros & Developers. It's quick & easy.

Compiler Error 2001 on long 2-d array initialiser

P: n/a
We have hit an internal compiler error when processing a very long array
initialiser (for a lookup table). Most of the compiler versions we tried
compiled the code successfully, but very slowly (one person reported hours,
but I have not seen that personally), but one failed:

Microsoft (R) 32-bit C/C++ Optimizing Compiler
Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

slow.c
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file
'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c' , line 148)

The code itself was automatically generated, and an extract is below
(the whole is available, but as 1233 lines, is a bit big to post).
(The code was originally generated into Fortran, where big DATA statements
are not unusual).

As the code is automatically generated from data held elsewhere,
we have worked round it by changing the big 2d table: int imbtab[ 87][191]
to 87 separate static tables, one for each row, and then a table of pointers
to the rows. This reworked version compiles quickly with no problems.

Tim

int ucf950( int ibyte, int istat )
{
int ipos, itab;
int isbtab[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15,
-16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31,
-32, -33, -34, -35, -36, -37, -38,-9999,-9999, -39, -40, -41, -42, -43, -44, -45,
-46, -47, -48, -49, -50, -51, -52, -53, -54, -55, -56, -57, -58, -59, -60, -61,
-62, -63, -64, -65, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76, -77,
-78, -79, -80, -81, -82, -83, -84, -85, -86, -87,-9999,-9999,-9999,-9999,-9999,-9999
};
int imbtab[ 87][191] = {
/* Row 1 (index 0) of IMBTAB gives the mappings for the follow bytes of lead byte 161 */
{ 12288,65292,12289,12290,65294, 8231,65307,65306,65311,65281,65072, 8230, 8229,65104,65105,65106,
183,65108,65109,65110,65111,65372, 8211,65073, 8212,65075, 9588,65076,65103,65288,65289,65077,
65078,65371,65373,65079,65080,12308,12309,65081,65 082,12304,12305,65083,65084,12298,12299,65085,
65086,12296,12297,65087,65088,12300,12301,65089,65 090,12302,12303,65091,65092,65113,65114,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,65115,65116,65117,65118, 8216, 8217, 8220, 8221,12317,12318, 8245, 8242,65283,65286,65290,
8251, 167,12291, 9675, 9679, 9651, 9650, 9678, 9734, 9733, 9671, 9670, 9633, 9632, 9661, 9660,
12963, 8453, 175,65507,65343, 717,65097,65098,65101,65102,65099,65100,65119,6512 0,65121,65291,
65293, 215, 247, 177, 8730,65308,65310,65309, 8806, 8807, 8800, 8734, 8786, 8801,65122,65123,
65124,65125,65126,65374, 8745, 8746, 8869, 8736, 8735, 8895,13266,13265, 8747, 8750, 8757, 8756,
9792, 9794, 8853, 8857, 8593, 8595, 8592, 8594, 8598, 8599, 8601, 8600, 8741, 8739,65295 },
/* Row 2 (index 1) of IMBTAB gives the mappings for the follow bytes of lead byte 162 */
{ 65340, 8725,65128,65284,65509,12306,65504,65505,65285,653 12, 8451, 8457,65129,65130,65131,13269,
13212,13213,13214,13262,13217,13198,13199,13252, 176,20825,20827,20830,20829,20833,20835,21991,
29929,31950, 9601, 9602, 9603, 9604, 9605, 9606, 9607, 9608, 9615, 9614, 9613, 9612, 9611, 9610,
9609, 9532, 9524, 9516, 9508, 9500, 9620, 9472, 9474, 9621, 9484, 9488, 9492, 9496, 9581,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999, 9582, 9584, 9583, 9552, 9566, 9578, 9569, 9698, 9699, 9701, 9700, 9585, 9586, 9587,65296,
65297,65298,65299,65300,65301,65302,65303,65304,65 305, 8544, 8545, 8546, 8547, 8548, 8549, 8550,
8551, 8552, 8553,12321,12322,12323,12324,12325,12326,12327,123 28,12329,21313,21316,21317,65313,
65314,65315,65316,65317,65318,65319,65320,65321,65 322,65323,65324,65325,65326,65327,65328,65329,
65330,65331,65332,65333,65334,65335,65336,65337,65 338,65345,65346,65347,65348,65349,65350,65351,
65352,65353,65354,65355,65356,65357,65358,65359,65 360,65361,65362,65363,65364,65365,65366 },

....and lots more similar blocks ending in

/* Row 87 (index 86) of IMBTAB gives the mappings for the follow bytes of lead byte 249 */
{ 32408,32411,32409,33248,33249,34374,34375,34376,35 193,35194,35196,35195,35327,35736,35737,36517,
36516,36515,37998,37997,37999,38001,38003,38729,39 026,39263,40040,40046,40045,40459,40461,40464,
40463,40466,40465,40609,40693,40713,40775,40824,40 827,40826,40825,22302,28774,31855,34876,36274,
36518,37315,38004,38008,38006,38005,39520,40052,40 051,40049,40053,40468,40467,40694,40714,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,-9999,
-9999,40868,28776,28773,31991,34410,34878,34877,348 79,35742,35996,36521,36553,38731,39027,39028,
39116,39265,39339,39524,39526,39527,39716,40469,40 471,40776,25095,27422,29223,34380,36520,38018,
38016,38017,39529,39528,39726,40473,29225,34379,35 743,38019,40057,40631,30325,39531,40058,40477,
28777,28778,40612,40830,40777,40856,30849,37561,35 023,22715,24658,31911,23290, 9556, 9574, 9559,
9568, 9580, 9571, 9562, 9577, 9565, 9554, 9572, 9557, 9566, 9578, 9569, 9560, 9575, 9563, 9555,
9573, 9558, 9567, 9579, 9570, 9561, 9576, 9564, 9553, 9552, 9581, 9582, 9584, 9583, 9619 }
};
/* -------- */
/* The Code */
/* -------- */
if ( ibyte < 0 )
/* Invalid value */
return -9999;
else if ( ibyte <= 255 ) {
if ( istat >= 0 )
/* lead byte */
return isbtab[ibyte];
else if ( istat >= -87 ) {
/* follow byte */
if ( ibyte < 64 )
return -9999;
else if ( ibyte <= 254 ) {
itab = -istat - 1;
ipos = ibyte - 64;
return imbtab[itab][ipos];
}
else
return -9999;
}
else
return -9999;
}
else
/* Invalid value */
return -9999;
}

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.