Microsoft KB Archive/116372

From BetaArchive Wiki

BUG: L1103 Error when Initializing __huge Data Array

Q116372

1.00 1.50 WINDOWS kbprg kbbuglist kberrmsg --------------------------------------------------------------------- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE), included with: Microsoft Visual C++ for Windows, version 1.0 and 1.5 --------------------------------------------------------------------- SYMPTOMS ======== When you build a project containing an initialized huge array, the linker generates this error message: L1103: TEST5_DATA : attempt to access data outside segment bounds TEST is the name of the source file where the initialization occurred. WORKAROUND ========== To work around this problem: - Initialize smaller memory objects, using pointers to reference them (see the TEST2.C sample below). -or- - Initialize the variable members within the executable code. -or- - Initialize the variable members within the executable code using a file to set data values (No sample provided). STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ This problem occurs only if an element that is near the 64K boundary of the array is initialized. In the sample code below, initializing the member "a[0].b" causes the error to occur: Sample Code ----------- *\ The following code sample does reproduce the problem. // TEST1.C struct test { int a[32767]; char b; }; struct test _huge a[2] = {{{1,2,3},{'a'}}, {{11,12,13},{'b'}}}; void main() {} The following code samples do not reproduce the problem: // TEST2.C int x[32767] = {1,2,3}; int y[32767] = {11,12,13}; struct test { int *a; char b; }; struct test _huge a[2] = {{x,'a'}, {y,'b'}}; void main() {} // TEST3.C struct test { int a[32767]; char b; }; struct test _huge a[2] = {0}; //Initialization prevents L1072 error void main() { a[0].a[0] = 1; a[0].a[1] = 2; a[0].a[2] = 3; a[0].b = 'a'; a[1].a[0] = 11; a[1].a[1] = 12; a[1].a[2] = 13; a[1].b = 'b'; } Additional reference words: 1.00 1.50 7.00 8.00 8.00c memory model initialize KBCategory: kbprg kbbuglist kberrmsg KBSubCategory: CLIss

Keywords : kb16bitonly
Issue type :
Technology :


Last Reviewed: July 25, 1997
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.