www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Error: array dimension overflow

reply Brian Hay <bhay construct3d.com> writes:
Newbie Q:

During compilation I'm getting the error: "array dimension overflow" but 
it doesn't provide any information as to where (module and line number) 
the error might be, so I'm at a loss. Other errors seem to provide such 
information.

Any ideas?
Mar 20 2008
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Brian Hay wrote:
 Newbie Q:
 
 During compilation I'm getting the error: "array dimension overflow" but 
 it doesn't provide any information as to where (module and line number) 
 the error might be, so I'm at a loss. Other errors seem to provide such 
 information.
 
 Any ideas?

I think there's a limit of 16K for the size of static arrays. Do you have any really big static arrays? Anyway, the compiler should generate a line number for that. Not providing one is a bug. --bb
Mar 21 2008
next sibling parent reply Brian Hay <bhay construct3d.com> writes:
Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" 
 but it doesn't provide any information as to where (module and line 
 number) the error might be, so I'm at a loss. Other errors seem to 
 provide such information.

 Any ideas?

I think there's a limit of 16K for the size of static arrays. Do you have any really big static arrays?

No. Nothing like that.
 Anyway, the compiler should generate a line number for that.  Not 
 providing one is a bug.

That's what I figured. It's kind of hard to track down the issue without such details.
Mar 21 2008
parent jcc7 <technocrat7 gmail.com> writes:
== Quote from Brian Hay (bhay construct3d.com)'s article
 Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:



...
 Anyway, the compiler should generate a line number for that.  Not
 providing one is a bug.

That's what I figured. It's kind of hard to track down the issue without such details.

I agree. I filed a bug report so that perhaps a future version of DMD would include a line number when it runs into this error: http://d.puremagic.com/issues/show_bug.cgi?id=1936
Mar 24 2008
prev sibling parent reply Spacen Jasset <spacen yahoo.co.uk> writes:
Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" 
 but it doesn't provide any information as to where (module and line 
 number) the error might be, so I'm at a loss. Other errors seem to 
 provide such information.

 Any ideas?

I think there's a limit of 16K for the size of static arrays. Do you have any really big static arrays? Anyway, the compiler should generate a line number for that. Not providing one is a bug. --bb

compilers for C support close to 64k indexes.
Apr 03 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Spacen Jasset" <spacen yahoo.co.uk> wrote in message 
news:ft35ik$q7g$1 digitalmars.com...
 Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" but 
 it doesn't provide any information as to where (module and line number) 
 the error might be, so I'm at a loss. Other errors seem to provide such 
 information.

 Any ideas?

I think there's a limit of 16K for the size of static arrays. Do you have any really big static arrays? Anyway, the compiler should generate a line number for that. Not providing one is a bug. --bb

compilers for C support close to 64k indexes.

Apr 03 2008
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:ft3757$11cb$1 digitalmars.com...
 "Spacen Jasset" <spacen yahoo.co.uk> wrote in message 
 news:ft35ik$q7g$1 digitalmars.com...
 Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" 
 but it doesn't provide any information as to where (module and line 
 number) the error might be, so I'm at a loss. Other errors seem to 
 provide such information.

 Any ideas?

I think there's a limit of 16K for the size of static arrays. Do you have any really big static arrays? Anyway, the compiler should generate a line number for that. Not providing one is a bug. --bb

compilers for C support close to 64k indexes.


Son of a. Bill made a typo, the max is 16MB. While Walter says that this is because "any larger array should really be allocated at runtime and not in the static data segment", I think it's really because OPTLINK crashes if you have something larger than 16MB in the static data segment. 9_9
Apr 03 2008
parent Spacen Jasset <spacenjasset yahoo.co.uk> writes:
Jarrett Billingsley wrote:
 "Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
 news:ft3757$11cb$1 digitalmars.com...
 "Spacen Jasset" <spacen yahoo.co.uk> wrote in message 
 news:ft35ik$q7g$1 digitalmars.com...
 Bill Baxter wrote:
 Brian Hay wrote:
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" 
 but it doesn't provide any information as to where (module and line 
 number) the error might be, so I'm at a loss. Other errors seem to 
 provide such information.

 Any ideas?

Do you have any really big static arrays? Anyway, the compiler should generate a line number for that. Not providing one is a bug. --bb

compilers for C support close to 64k indexes.


Son of a. Bill made a typo, the max is 16MB. While Walter says that this is because "any larger array should really be allocated at runtime and not in the static data segment", I think it's really because OPTLINK crashes if you have something larger than 16MB in the static data segment. 9_9

need becomes more pressing. Nothing to worry about too much... moving on. :-)
Apr 04 2008
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Brian Hay" <bhay construct3d.com> wrote in message 
news:frviab$126$1 digitalmars.com...
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" but 
 it doesn't provide any information as to where (module and line number) 
 the error might be, so I'm at a loss. Other errors seem to provide such 
 information.

 Any ideas?

Hee hee hee. static int[] x = [-1: 1]; There's some kind of funky logic in the compiler which for some reason does not detect negative initialization indices, but rather does something like currentLength = index.toInt(); currentLength++; if(currentLength == 0) error("array dimension overflow"); It's to detect index overflow, but it's easily fooled by using a negative index, which it should really detect anyway. Are you using, maybe, 0xFFFF_FFFF anywhere as an array initializer index? Also, are you getting an "array initializers as expressions are not allowed" error at the same time by any chance?
Mar 21 2008
next sibling parent Christopher Wright <dhasenan gmail.com> writes:
Jarrett Billingsley wrote:
 "Brian Hay" <bhay construct3d.com> wrote in message 
 news:frviab$126$1 digitalmars.com...
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" but 
 it doesn't provide any information as to where (module and line number) 
 the error might be, so I'm at a loss. Other errors seem to provide such 
 information.

 Any ideas?

Hee hee hee. static int[] x = [-1: 1];

Why do you hate the compiler? Meanie. /me sniffles.
Mar 21 2008
prev sibling parent Brian Hay <bhay construct3d.com> writes:
Jarrett Billingsley wrote:
 "Brian Hay" <bhay construct3d.com> wrote in message 
 news:frviab$126$1 digitalmars.com...
 Newbie Q:

 During compilation I'm getting the error: "array dimension overflow" but 
 it doesn't provide any information as to where (module and line number) 
 the error might be, so I'm at a loss. Other errors seem to provide such 
 information.

 Any ideas?

Hee hee hee. static int[] x = [-1: 1]; There's some kind of funky logic in the compiler which for some reason does not detect negative initialization indices

Thanks Jarrett, that was it.
Mar 21 2008