[Issue 3245] Easy bug fix available for disabled unit test code in std.encoding

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3245


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-12 
00:23:37 PDT ---
Terrific, thanks. I looked at that and couldn't figure the problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3246] New: ICE(init.c) using indexed array initializer on local array

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3246

   Summary: ICE(init.c) using indexed array initializer on local
array
   Product: D
   Version: 1.046
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code, patch
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


Reported by Ali Cehreli.

void main()
{
int[4] static_1 = [ 3:212 ];
}

PATCH against DMD2.031. We need to make sure the array literal is big enough to
include the last mentioned element.
We need to return ErrorExp, not NULL, otherwise it will still segfault on cases
like int[4] x = [32: 1]; because VerDeclaration::semantic assumes a NULL result
means that it should run semantic on the initializer.

Index: init.c
===
--- init.c(revision 194)
+++ init.c(working copy)
@@ -422,6 +422,13 @@
 else
 edim = value.dim;

+for (size_t i = 0, j = 0; i  value.dim; i++, j++)
+{
+if (index.data[i])
+j = ((Expression *)index.data[i])-toInteger();
+if (j =edim) edim = j+1;
+}
+
 elements = new Expressions();
 elements-setDim(edim);
 for (size_t i = 0, j = 0; i  value.dim; i++, j++)
@@ -464,7 +471,7 @@
 Lno:
 delete elements;
 error(loc, array initializers as expressions are not allowed);
-return NULL;
+return new ErrorExp();
 }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 874] Incorrect codegen (?) with tuples, string constants, and AAs

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=874


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au




--- Comment #2 from Don clugd...@yahoo.com.au  2009-08-12 06:17:48 PDT ---
The equivalent code (below) works correctly on D2. This is a D1-only bug.
-
import std.stdio;
template AA(V, K) {
V[K] AA(T...)(T args) {
V[K] ret;
K key;

foreach(i, arg; args) {
static if(!(i  1))
key = arg;
else
ret[key] = arg;
}
return ret;
}
}
void main()
{
string[string] array = AA!(string, string)(a, b[], c[], d[]);
writefln(length = %d\n, array.length);
foreach(k, v; array)
writefln(array[%d]=%s, k, v);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 999] Problem with auto and nested array literals

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=999


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED




--- Comment #3 from Don clugd...@yahoo.com.au  2009-08-12 06:37:21 PDT ---
This, the Dstress cases, and the cases in 919, all work in DMD1.045 and 2.030.
(Tested both Windows + Linux).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3247] New: Crash on overriding class methods with 'auto' return type

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3247

   Summary: Crash on overriding class methods with 'auto' return
type
   Product: D
   Version: 2.031
  Platform: Other
OS/Version: All
Status: NEW
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: jarrett.billings...@gmail.com


class A
{
auto foo() { return 0; }
}

class B : A
{
override auto foo() { return 5; } 
}


The compiler crashes.  It also crashes if A.foo's return type is int or B.foo's
return type is int (but not if both are int, obviously).  It doesn't crash if
foo is not overridden.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3247] Crash on overriding class methods with 'auto' return type

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3247


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au




--- Comment #1 from Don clugd...@yahoo.com.au  2009-08-12 08:48:53 PDT ---
Is it the same as bug#3042?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3042] Segfault on incorrect override

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3042


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||jarrett.billings...@gmail.c
   ||om




--- Comment #2 from Don clugd...@yahoo.com.au  2009-08-12 08:51:45 PDT ---
*** Issue 3247 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 928] nested struct definition in unittest section of a templated class, hangs DMD

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=928


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch
 CC||clugd...@yahoo.com.au




--- Comment #2 from Don clugd...@yahoo.com.au  2009-08-12 11:29:31 PDT ---
Straightforward patch. This is just a copy-and-paste of the code for the other
recursive template expansion checks.
Patch against DMD 2.031.

Index: template.c
===
--- template.c(revision 194)
+++ template.c(working copy)
@@ -3592,7 +3592,27 @@

 if (sc-func || dosemantic3)
 {
+#if WINDOWS_SEH
+  __try
+  {
+#endif
+if (++nest  500)
+{
+global.gag = 0;// ensure error message gets printed
+error(recursive expansion);
+fatal();
+}
 semantic3(sc2);
+--nest;
+#if WINDOWS_SEH
+  }
+  __except (__ehfilter(GetExceptionInformation()))
+  {
+global.gag = 0;// ensure error message gets printed
+error(recursive expansion);
+fatal();
+  }
+#endif
 }

   Laftersemantic:

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3101] Stack overflow: declaring aggregate member twice with static if

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3101


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch




--- Comment #3 from Don clugd...@yahoo.com.au  2009-08-12 11:26:48 PDT ---
Patch is very easy.

in int AliasDeclaration::overloadInsert(Dsymbol *s), make sure it doesn't call
itself.


Index: declaration.c
===
--- declaration.c(revision 194)
+++ declaration.c(working copy)
@@ -543,6 +543,8 @@
 {overnext = s;
 return TRUE;
 }
+else if (overnext==this) // a recursive expansion would ensue. Bugzilla
3101
+   return FALSE;
 else
 {
 return overnext-overloadInsert(s);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3248] lossless floating point formatting

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3248





--- Comment #2 from assorted moi...@hotmail.com  2009-08-12 15:40:10 PDT ---
(In reply to comment #1)
 It's not that easy, actually. When should it print 0.0, and
 when should it print 0.1 ? The code to do it correctly is amazingly
 complicated.
 Just be aware that what you're asking for is much more difficult than you
 probably imagine.

It is less difficult than you imagine :)

Lets take floats:

A float has at most 24bits of precision

2^-24 = 0.00059604644775390625
2^-23 = 0.0011920928955078125

to distinguish between these two you only need a precision of 8.

Thus %.8e will always be lossless but isn't always the nicest way of
representation. %g fixes this by using %f if the exponent for an e format is
greater than -5 and less than the precision. The less than precision part is
correct, but the greater than 10^-5 is bad as the precision specifies the
number of digits generated after the decimal point; not excluding leading
zeros.
If %g would be changed to use %f only between 10^-1 and precision that would
solve that problem, if %f were to elide trailing zeros.

Back to the 0.1 question. 0.1 is actually saved as 0.100012...
Eliding trailing zeros from %f.8 would be sufficient to get 0.1

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3249] sort and setIntersection on array of struct or class

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3249


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||and...@metalanguage.com
 AssignedTo|nob...@puremagic.com|and...@metalanguage.com




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-12 
16:21:53 PDT ---
This is because the default comparison is passed as a string, which does not
see the definition of the struct. I'll change that to a function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3248] lossless floating point formatting

2009-08-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3248


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

 CC||s...@iname.com




--- Comment #3 from Stewart Gordon s...@iname.com  2009-08-12 18:21:21 PDT ---
I can see a few possible approaches to lossless floating point formatting:

(a) decimal with infinite precision, minus trailing zeros
(b) minimum number of significant figures guaranteed to be unique, minus
trailing zeros
(c) the shortest possible string that, when parsed as a floating point, is
exactly this number

(a) clearly isn't what the reporter is asking for.

(b) seems straightforward.  (Is the number of s.f. in question just the .dig
property?)

(c) is optimal, and could probably be implemented quite simply (not sure
whether it would be most efficient though) with the aid of the nextUp and
nextDown functions.  This would also address the question in comment 1, though
I'm not sure how easy it would be to implement this efficiently.

But (b) and (c) are ambiguous: do we go by uniqueness/exactitude in the real
type or in the actual floating point type being used?  I can see that sometimes
the app'll know what type it will later be read into, and sometimes it won't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---