BUG: L1103 Error when Initializing __huge Data Array

Last reviewed: July 22, 1997
Article ID: 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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.