digitalmars.D.bugs - [Issue 4623] New: Non-integer type allowed as static array size
- d-bugmail puremagic.com (26/26) Aug 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- d-bugmail puremagic.com (31/31) Sep 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- d-bugmail puremagic.com (7/7) Sep 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- d-bugmail puremagic.com (22/22) Sep 29 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- d-bugmail puremagic.com (14/16) Sep 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- d-bugmail puremagic.com (10/10) Oct 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
- Don (3/13) Oct 01 2010 I was only referring to the ICE bugs in dstress.
- d-bugmail puremagic.com (12/12) Oct 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4623
http://d.puremagic.com/issues/show_bug.cgi?id=4623 Summary: Non-integer type allowed as static array size Product: D Version: D1 & D2 Platform: All OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: ibuclaw ubuntu.com The code: void main() { int[0.128] a; } Should not compile, rather error with the message stating that either the size of array 'a' has non-integer type, or that the compiler cannot implicitly convert expression (0.128) of type double to uint. See: http://dstress.kuehne.cn/nocompile/o/opIndex_05.d Regards -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |clugdbug yahoo.com.au PATCH mtype.c, TypeSArray::semantic(), line 3344. dinteger_t d1 = dim->toInteger(); - dim = dim->castTo(sc, tsize_t); + dim = dim->implicitCastTo(sc, Type::tsize_t); dim = dim->optimize(WANTvalue); dinteger_t d2 = dim->toInteger(); if (dim->op == TOKerror) goto Lbaddim; if (d1 != d2) goto Loverflow; ... and further down: Loverflow: error(loc, "index %jd overflow for static array", d1); + Lbaddim: dim = new IntegerExp(0, 1, tsize_t); TEST CASE for test suite //bug 4623 static assert( !is (typeof(() {int[123.1] x; return x; }))); I've done this patch in a relatively complicated way, so that something like: int[7654321.0] bug4623b; generates only one error message, not two. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623 Can't you catch it in the lexer? Just thinking out loud... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623 You can catch it in parse.c -2428,6 +2428,12 { //printf("it's type[expression]\n"); inBrackets++; + + if (token.value != TOKint32v && token.value != TOKuns32v && + token.value != TOKint64v && token.value != TOKuns64v && + peekNext() == TOKrbracket) + error("I should be a an integral value, not [%s]", token.toChars()); + Expression *e = parseAssignExp(); // [ expression ] if (token.value == TOKslice) { I certainly don't mind either way. Your patch works just great, thanks! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 29 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623You can catch it in parse.c[snip] You can, but then it doesn't catch things like: const float f = 1.23; int[f] z;I certainly don't mind either way. Your patch works just great, thanks!It looks as though you got that case from dstress. Have you been running the dstress tests? If you have, I'd be very interested to see the results. I believe that all the compiler ICE bugs are fixed, but I have no idea about how many others are still failing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 30 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623 I haven't ran dstress using the DMD compiler. I think I stumbled upon the case somewhere from an archived message on the ML that probably got forgotten about. I wouldn't go as far as saying all compiler ICE bugs are fixed just yet (I raised an issue recently with CTFE with a patch supplied, for example), though they certainly are very far and few between now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 01 2010
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=4623 --- I haven't ran dstress using the DMD compiler. I think I stumbled upon the case somewhere from an archived message on the ML that probably got forgotten about.Ah, OK.I wouldn't go as far as saying all compiler ICE bugs are fixed just yet (I raised an issue recently with CTFE with a patch supplied, for example), though they certainly are very far and few between now.I was only referring to the ICE bugs in dstress.
Oct 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 18:18:23 PDT --- http://www.dsource.org/projects/dmd/changeset/712 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2010