[Issue 6503] New: std.typecons.scoped fails to instantiate for classes that inherit from interfaces

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6503

   Summary: std.typecons.scoped fails to instantiate for classes
that inherit from interfaces
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: debio...@gmail.com


--- Comment #0 from Andrew Wiley debio...@gmail.com 2011-08-16 00:40:11 PDT 
---
code sample:
import std.typecons, std.stdio;

class A {
this() { writeln(A); }
~this() { writeln(~A); }
}

interface Bob {}

class ABob : A, Bob {
this() { writeln(ABob); }
~this() { writeln(~ABob); }
}

void main() { auto abob = scoped!ABob(); }

ABob is just a normal class, and creating an instance of it on the stack
shouldn't be a problem, but scoped fails to instantiate because
std.typecons.destroy fails to instantiate:


/usr/include/d2/4.6.0/std/typecons.d:2571: Error: template
std.typecons.destroy(T) if (is(T == class)) does not match any function
template declaration
/usr/include/d2/4.6.0/std/typecons.d:2571: Error: template
std.typecons.destroy(T) if (is(T == class)) cannot deduce template function
from argument types !()(A,Bob)
/usr/include/d2/4.6.0/std/typecons.d:2530: Error: template instance
std.typecons.destroy!(ABob) error instantiating
scopedtest.d:18:instantiated from here: scoped!(ABob,)
scopedtest.d:18: Error: template instance std.typecons.scoped!(ABob,) error
instantiating


This error is interesting:
cannot deduce template function from argument types !()(A,Bob)

it looks like we're getting some sort of tuple of ABob's superclasses, trying
to instantiate destroy on it, and failing.

The correct behavior should be to special case classes that implement
interfaces so the interfaces are ignored when figuring out how to call
destructors.

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


[Issue 5766] undefined reference to `_D3std4bind12__ModuleInfoZ'

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5766


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

   What|Removed |Added

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


--- Comment #2 from Don clugd...@yahoo.com.au 2011-08-16 00:48:31 PDT ---
This bug report is incomprehensible to me.
What's the bug? Is it the segfault in lifetime.d? Or the linker error?

How was it built on Windows? The build script seems not be valid for Windows.
Also the source is huge. Please reduce it to a reasonably-sized test case.

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


[Issue 6463] Segfault on writeln() from a Fiber

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6463



--- Comment #3 from Danny Arends danny.are...@gmail.com 2011-08-16 01:02:02 
PDT ---
Created an attachment (id=1017)
Segfault from fiber

The file I forgot to attach

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


[Issue 6463] Segfault on writeln() from a Fiber

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6463



--- Comment #4 from Danny Arends danny.are...@gmail.com 2011-08-16 01:02:30 
PDT ---
Sorry forgot to attach the file.

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


[Issue 6499] [GSoC] Destructor not called on object returned by method.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6499


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-08-16 
01:17:38 PDT ---
https://github.com/D-Programming-Language/dmd/commit/cedaaa8927604ebc8b53ebb53c25e586eccd2755

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


[Issue 6434] opDispatch must be considered before alias this.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6434


Max Samukha samu...@voliacable.com changed:

   What|Removed |Added

 CC||samu...@voliacable.com


--- Comment #2 from Max Samukha samu...@voliacable.com 2011-08-16 02:39:02 
PDT ---
I am not sure. opDispatch is meant to be a fallback mechanism used after all
regular lookups fail. For example, one intended use of opDispatch is to
dynamically handle calls to members unavailable statically. With alias this
given the lowest priority, one would need to manually forward calls to
inherited members:

struct A
{
   Variant i;
   alias i this;

   auto opDispatch(string name, A...)(auto ref A args)
   {
   static if (isCallableOnI!(name, A)))
   mixin(return i. ~ name ~ (args);); // this shouldn't be
necessary
   else
   return dispatchDynamically(name, toVariants(args)); 
   }
}

So the bug is in opDispatch not being considered after alias this lookup
fails, and not in the order of lookups.

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


[Issue 6434] opDispatch must be considered before alias this.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6434



--- Comment #3 from Max Samukha samu...@voliacable.com 2011-08-16 03:07:32 
PDT ---
On the other hand, opDispatch considered first gives much more flexibility.
Then, what to do with regular inheritance:

class A
{ 
int foo();
}

class B : A
{
   void opDispatch(string name)()
   {
   }
}

auto b = new B;
b.foo();

Should foo be opDispatched?

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


[Issue 6434] opDispatch must be considered before alias this.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6434



--- Comment #4 from Gor Gyolchanyan g...@boloneum.com 2011-08-16 03:55:33 PDT 
---
I agree. This would make more sense. Let the opDispatch be used after alias
this.

(In reply to comment #2)
 I am not sure. opDispatch is meant to be a fallback mechanism used after all
 regular lookups fail. For example, one intended use of opDispatch is to
 dynamically handle calls to members unavailable statically. With alias this
 given the lowest priority, one would need to manually forward calls to
 inherited members:
 
 struct A
 {
Variant i;
alias i this;
 
auto opDispatch(string name, A...)(auto ref A args)
{
static if (isCallableOnI!(name, A)))
mixin(return i. ~ name ~ (args);); // this shouldn't be
 necessary
else
return dispatchDynamically(name, toVariants(args));
  
}
 }
 
 So the bug is in opDispatch not being considered after alias this lookup
 fails, and not in the order of lookups.

I think all VISIBLE members should be used before opDispatch.

(In reply to comment #3)
 On the other hand, opDispatch considered first gives much more flexibility.
 Then, what to do with regular inheritance:
 
 class A
 { 
 int foo();
 }
 
 class B : A
 {
void opDispatch(string name)()
{
}
 }
 
 auto b = new B;
 b.foo();
 
 Should foo be opDispatched?

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


[Issue 6499] [GSoC] Destructor not called on object returned by method.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6499


Cristi Cobzarenco cristi.cobzare...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


--- Comment #3 from Cristi Cobzarenco cristi.cobzare...@gmail.com 2011-08-16 
06:18:13 PDT ---
Thanks for the fix Kenji. However, this still doesn't work if bar() is a
template function, i.e:

struct Bar {
string m = not set;

this( string s ) { writeln( Constructor - , m = s ); }
this( this ) { writeln( Postblit- , m ); }
~this()  { writeln( Destructor  - , m ); }

// NOTE: bar is a template, otherwise it works
Bar bar()()  { return Bar( bar ); }
}

Bar foo() { return Bar( foo ); }

void main() {
foo().bar();
}

Outputs:
Constructor - foo
Constructor - bar
Destructor  - bar

Interestingly, this time it's the one returned by foo() that doesn't get
destroyed, rather than the one returned by bar().

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


[Issue 6505] Wrong code for expression involving 8 floats, only with -O

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6505


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2011-08-16 06:37:50 PDT ---
Simplified a little:


double foo() {
return 1.0;
}
void main() {
double a = foo();
double b = foo();
double x = a*a + a*a + a*a + a*a + a*a + a*a + a*a +
   a*b + a*b;
assert(x  0);
}


---

Asm normal compilation:

_D4test3fooFZdcomdat
fld1
ret

__Dmaincomdat
L0:enter024h,0
callnear ptr _D4test3fooFZd
fstpqword ptr -018h[EBP]
callnear ptr _D4test3fooFZd
fstpqword ptr -010h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -010h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -010h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
fdecstp
fstpqword ptr -024h[EBP]
fldqword ptr -018h[EBP]
fmulqword ptr -018h[EBP]
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
fldqword ptr -024h[EBP]
faddpST(1),ST
fstpqword ptr -8[EBP]
fldqword ptr -8[EBP]
ftst
fstswAX
sahf
fstpST
jaL7B
movEAX,9
callnear ptr _D4test8__assertFiZv
L7B:xorEAX,EAX
leave
ret



Asm compilation with -O:

_D4test3fooFZdcomdat
fldqword ptr FLAT:_DATA[00h]
ret

__Dmaincomdat
L0:subESP,034h
callnear ptr _D4test3fooFZd
fstpqword ptr 0Ch[ESP]
callnear ptr _D4test3fooFZd
fldqword ptr 0Ch[ESP]
fldqword ptr 0Ch[ESP]
fxchST2
fstpqword ptr 014h[ESP]
fmulqword ptr 014h[ESP]
fxchST1
fldqword ptr 0Ch[ESP]
fxchST1
fmulqword ptr 014h[ESP]
fxchST1
fmulST,ST(0)
fldqword ptr 0Ch[ESP]
fmulST,ST(0)
fldqword ptr 0Ch[ESP]
fmulST,ST(0)
fldqword ptr 0Ch[ESP]
fmulST,ST(0)
fldqword ptr 0Ch[ESP]
fmulST,ST(0)
fldqword ptr 0Ch[ESP]
fmulST,ST(0)
fdecstp
fldqword ptr 0Ch[ESP]
fxchST1
fstpqword ptr [ESP]
fmulST,ST(0)
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
faddpST(1),ST
fldqword ptr [ESP]
faddpST(1),ST
ftst
fstswAX
fstpST
sahf
jaL84
movEAX,9
callnear ptr _D4test8__assertFiZv
L84addESP,034h
xorEAX,EAX
ret



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


[Issue 6501] import inside of eponymous template does not work correctly

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6501


kenn...@gmail.com changed:

   What|Removed |Added

 CC||kenn...@gmail.com
Version|unspecified |D2


--- Comment #1 from kenn...@gmail.com 2011-08-16 06:49:05 PDT ---
This is because the template has more than one member. Those symbols imported
from std.metastrings can now be accessed from the template, e.g.

--
pragma(msg, eponymous!message.Format);
// prints template Format(A...)
pragma(msg, eponymous!message.eponymous);
// prints message
--

Perhaps this is by-design.

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


[Issue 6501] import inside of eponymous template does not work correctly

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6501



--- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2011-08-16 10:30:01 
PDT ---
Per TDPL, eponymous templates are supposed to be able to have multiple members
(but just one with the same name as the template). So, if that's the issue
here, it's a bug related to not yet fully following TDPL.

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


[Issue 6506] New: OS X: wrong value is passed to simple argument with a lazy parameter with -unittest -release -O

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6506

   Summary: OS X: wrong value is passed to simple argument with a
lazy parameter with -unittest -release -O
   Product: D
   Version: D2
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Keywords: wrong-code
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: kenn...@gmail.com


--- Comment #0 from kenn...@gmail.com 2011-08-16 10:58:09 PDT ---

void enforce6506(bool condition, lazy int m) {
assert(!condition);
}
void toImpl6506(int value) {
enforce6506(value = 0, 4);
}
void bug6506() {
toImpl6506(-112345);
}

void main() { bug6506(); }

$ dmd -unittest -release -O z.d
$ ./z
core.exception.AssertError@z(2): Assertion failure
...


The bug _does_not_ appear when:
 - one of '-unittest', '-release', and '-O' doesn't exist.
 - the type of 'condition' is not 'bool', 'u?(byte|short|int)' and '[wd]?char'.
 - the 'lazy' argument doesn't exist.

This bug is preventing OS X from passing Phobos' unit test in the release build
after fixing bug 6377. See also
https://github.com/D-Programming-Language/phobos/commit/994d76fe.

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


[Issue 6499] [GSoC] Destructor not called on object returned by method.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6499



--- Comment #4 from Kenji Hara k.hara...@gmail.com 2011-08-16 11:46:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/316

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


[Issue 6506] OS X: wrong value is passed to simple argument along with a delegate with -O

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6506


kenn...@gmail.com changed:

   What|Removed |Added

Summary|OS X: wrong value is passed |OS X: wrong value is passed
   |to simple argument with a   |to simple argument along
   |lazy parameter with |with a delegate with -O
   |-unittest -release -O   |


--- Comment #1 from kenn...@gmail.com 2011-08-16 11:50:31 PDT ---
Correction:

1. Only -O is needed.
2. It's not 'lazy' causing the bug, but passing a nested delegate.

---
void enforce6506b(bool condition, void delegate() m) {
assert(!condition);
}
void toImpl6506b(int value) {
void f(){}
enforce6506b(value = 0, f);
}
void bug6506b() {
toImpl6506b(-112345);
}

void main() { bug6506b(); }
---
$ dmd -O z.d
$ ./z
core.exception.AssertError@z(2): Assertion failure
...
---

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


[Issue 6508] New: alias this doesn't work with AssignExp rhs

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6508

   Summary: alias this doesn't work with AssignExp rhs
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2011-08-16 12:32:33 PDT ---
This is similar to bug 6369, but different.

template Seq(T...)
{
alias T Seq;
}

void main()
{
int x, y;
Seq!(x, y) = tup(10, 20);
assert(x == 10);
assert(y == 20);
}

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


[Issue 6507] [2.055 beta] ICE: var Internal error: backend\cgcs.c 319

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6507



--- Comment #1 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
12:33:58 PDT ---
Also, using 'enum x = stripLeft(Hi);' results in:

Internal error: backend\cgcs.c 526

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


[Issue 6507] New: [2.055 beta] ICE: var Internal error: backend\cgcs.c 319

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6507

   Summary: [2.055 beta] ICE: var Internal error: backend\cgcs.c
319
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
12:31:44 PDT ---
In the latest DMD/druntime/phobos from github (as of this writing):

import std.string;
void main()
{
stripLeft(Hi);
}

Compiler gives:
var Internal error: backend\cgcs.c 319

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


[Issue 6507] [2.055 beta] ICE: var Internal error: backend\cgcs.c 319

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6507


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

   Severity|normal  |regression


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


[Issue 6508] alias this doesn't work with AssignExp rhs

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6508



--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-08-16 12:35:18 PDT ---
Sorry, Comment#0's sample code is incomplete.

template Seq(T...)
{
alias T Seq;
}
struct Tup(T...)
{
T field;
alias field this;
}
void main()
{
int x, y;
Seq!(x, y) = Tup!(int, int)(10, 20);
assert(x == 10);
assert(y == 20);
}

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


[Issue 6455] std.string.format doesn't understand positional arguments

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6455


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||cbkbbej...@mailinator.com
 Resolution||DUPLICATE


--- Comment #1 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
12:42:22 PDT ---
*** This issue has been marked as a duplicate of issue 4532 ***

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


[Issue 4532] Position specifiers don't work in format

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4532


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 CC||simend...@gmail.com


--- Comment #3 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
12:42:22 PDT ---
*** Issue 6455 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 6499] [GSoC] Destructor not called on object returned by method.

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6499



--- Comment #5 from Cristi Cobzarenco cristi.cobzare...@gmail.com 2011-08-16 
12:46:41 PDT ---
Thanks a lot for the fix, this stops the memory leak I had in my project. Hope
it gets merged into the head soon.

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


[Issue 6509] New: [2.055 beta] ICE when compiling druntime or phobos

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6509

   Summary: [2.055 beta] ICE when compiling druntime or phobos
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
12:49:40 PDT ---
This has been going on for at least a few days. When I compile the latest DMD
from github, and then use it to compile the latest druntime or phobos from
github, I get:

Internal error: backend\gflow.c 931

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


[Issue 6510] New: [CTFE] internal error: illegal stack value stack

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6510

   Summary: [CTFE] internal error: illegal stack value stack
   Product: D
   Version: D2
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dmitry.o...@gmail.com


--- Comment #0 from Dmitry Olshansky dmitry.o...@gmail.com 2011-08-16 
13:39:07 PDT ---
Recently found this one in my GSOC project. As this involves compilation of
regex at CTFE, I'm not yet able to produce small test case.

dmd spits this:
..\..\fred.d(2020): Error: CTFE internal error: illegal stack value stack

Assertion failure: 'isStackValueValid(newval)' on line 5452 in file
'interpret.c'

abnormal program termination

But anyway, what kind of situation is supposed to trigger that assert?

My dmd is 2.055 compiled form github with last commit being:
 Merge pull request #293 from 9rnsr/fix2246 
 4a1c9e7646ed9152f9644cd29d07968583888cb2

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


[Issue 6511] New: [CTFE] Array op gives wrong result

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6511

   Summary: [CTFE] Array op gives wrong result
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-08-16 13:49:05 PDT ---
T foo(T)() {
T[1] a = [1];
a[] += a[];
return a[0];
}
static assert(foo!ulong() == 2); // error
static assert(foo!long() == 2); // error
void main() {
assert(foo!ulong() == 2); // OK
assert(foo!long() == 2); // OK
}


DMD gives:

test.d(6): Error: static assert  (1LU == 2LU) is false

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


[Issue 6512] New: [CTFE] new T[][] doesn't work

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6512

   Summary: [CTFE] new T[][] doesn't work
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-08-16 13:51:20 PDT ---
This is almost an enhancement request.


int foo() {
new int[][](1, 1);
return 0;
}
enum _ = foo();
void main() {}


test.d(2): Error: Cannot interpret new int[][](1u,1u) at compile time
test.d(5): Error: cannot evaluate foo() at compile time


While this code works:

int foo() {
int[][] m;
m.length = 1;
m[0].length = 1;
assert(m == [[0]]);
return 0;
}
enum _ = foo();
void main() {}

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


[Issue 6513] New: More info in Range violation exception message?

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6513

   Summary: More info in Range violation exception message?
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-08-16 13:56:45 PDT ---
This is a wrong D2 program:

void main() {
auto foo = new int[][](10, 10);
int i = 2;
foo[i][$ + 1] = 1;
}



It gives at run-time:

core.exception.RangeError@test(4): Range violation


But if possible I'd like a more decriptive message, that gives more
information, something like:

core.exception.RangeError@test(4): Range violation (array 'foo[2]', length=10,
index=11)

(The disadvantage of this error message is that the binary gets larger in
nonrelease mode. If this is too much overhead, then consider a similar message
in -debug compilation only).

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


[Issue 6514] New: dotProduct at compile-time too

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6514

   Summary: dotProduct at compile-time too
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-08-16 14:00:14 PDT ---
Currently (DMD 2.054) I can't run dotProduct() at compile-time, but small
changes allow it too. Not much tested:


/// Ditto
Unqual!(CommonType!(F1, F2))
dotProduct(F1, F2)(in F1[] avector, in F2[] bvector) pure nothrow @system {
enum size_t big_block_size = 16;
enum size_t small_block_size = 4;
//static assert(isPow2(big_block_size)); // isPow2 missing in std.math
//static assert(isPow2(small_block_size));

immutable n = avector.length;
assert(n == bvector.length);
auto avec = avector.ptr, bvec = bvector.ptr;
typeof(return) sum0 = 0, sum1 = 0;

const all_endp = avec + n;
const smallblock_endp = avec + (n  ~(small_block_size - 1));
const bigblock_endp = avec + (n  ~(big_block_size - 1));

for (; avec != bigblock_endp; avec += big_block_size, bvec +=
big_block_size) {
sum0 += avec[0] * bvec[0];
sum1 += avec[1] * bvec[1];
sum0 += avec[2] * bvec[2];
sum1 += avec[3] * bvec[3];
sum0 += avec[4] * bvec[4];
sum1 += avec[5] * bvec[5];
sum0 += avec[6] * bvec[6];
sum1 += avec[7] * bvec[7];
sum0 += avec[8] * bvec[8];
sum1 += avec[9] * bvec[9];
sum0 += avec[10] * bvec[10];
sum1 += avec[11] * bvec[11];
sum0 += avec[12] * bvec[12];
sum1 += avec[13] * bvec[13];
sum0 += avec[14] * bvec[14];
sum1 += avec[15] * bvec[15];
}

for (; avec != smallblock_endp; avec += small_block_size, bvec +=
small_block_size) {
sum0 += avec[0] * bvec[0];
sum1 += avec[1] * bvec[1];
sum0 += avec[2] * bvec[2];
sum1 += avec[3] * bvec[3];
}

sum0 += sum1;

// Do trailing portion in naive loop.
if (__ctfe) {
const size_t left = (n % big_block_size) % small_block_size;
for (size_t i = n - left; i  n; i++)
sum0 += avec[i] * bvec[i];
} else {
while (avec != all_endp)
sum0 += (*avec++) * (*bvec++);
}

return sum0;
}




Note that this block of code:

sum0 += avec[0] * bvec[0];
sum1 += avec[1] * bvec[1];
sum0 += avec[2] * bvec[2];
sum1 += avec[3] * bvec[3];
sum0 += avec[4] * bvec[4];
sum1 += avec[5] * bvec[5];
sum0 += avec[6] * bvec[6];
sum1 += avec[7] * bvec[7];
sum0 += avec[8] * bvec[8];
sum1 += avec[9] * bvec[9];
sum0 += avec[10] * bvec[10];
sum1 += avec[11] * bvec[11];
sum0 += avec[12] * bvec[12];
sum1 += avec[13] * bvec[13];
sum0 += avec[14] * bvec[14];
sum1 += avec[15] * bvec[15];


Equals to something like:

foreach (i; Iota!(big_block_size / 2)) {
sum0 += avec[2 * i] * bvec[2 * i];
sum1 += avec[2 * i + 1] * bvec[2 * i + 1];
}

Where Iota is defined in Issue 4085

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


[Issue 4424] Copy constructor and templated opAssign cannot coexist

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4424


Cristi Cobzarenco cristi.cobzare...@gmail.com changed:

   What|Removed |Added

 CC||cristi.cobzare...@gmail.com


--- Comment #4 from Cristi Cobzarenco cristi.cobzare...@gmail.com 2011-08-16 
14:03:26 PDT ---
The link Kenji posted is not working any more. Here's a link to his pull
request that fixes this issue, as well as Issue 6216:
https://github.com/D-Programming-Language/dmd/pull/166

I hope this gets pulled soon.

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


[Issue 6515] New: Support for a basic BinaryHeap operation

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6515

   Summary: Support for a basic BinaryHeap operation
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-08-16 14:42:17 PDT ---
I'd like to create an empty heap, and then add to it an arbitrary (and
statically unknown) number of items, keeping the heap invariant valid all the
time (this means the heap invariant is valid after each item is added to the
heap, so I am free to pop items in any moment). Is this possible with
std.container.BinaryHeap?

If this is not possible then I think this is a common and really basic
operation that needs to be possible. If it's already possible, then I suggest
to add a little example to the std.container.BinaryHeap module docs that shows
how you do it.

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


[Issue 6503] std.typecons.scoped fails to instantiate for classes that inherit from interfaces

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6503


Andrew Wiley debio...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from Andrew Wiley debio...@gmail.com 2011-08-16 16:01:20 PDT 
---
Fix merged
https://github.com/D-Programming-Language/phobos/pull/199

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


[Issue 6509] [2.055 beta] ICE when compiling druntime or phobos

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6509


Brad Roberts bra...@puremagic.com changed:

   What|Removed |Added

 CC||bra...@puremagic.com


--- Comment #1 from Brad Roberts bra...@puremagic.com 2011-08-16 18:41:11 PDT 
---
You're going to have to be more detailed in this report.  The auto-tester is
and has been successfully compiling the trio just fine.  The last time the
linux32 build failed was on the 13th for a short period of time.  Win32 has had
some phobos build issues (more frequent than linux32), but none of the failures
I looked at were dmd crashes of any sort.

So.. that tends to point to a local dmd build problem.  Are you running with
any changes that haven't been pulled into master yet?  What compiler are you
using?  Anything else you can think of that's relevant?

Without repro steps, this bug report is unlikely to go anywhere.

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


[Issue 6510] [CTFE] internal error: illegal stack value stack

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6510


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2011-08-16 19:32:55 PDT ---
(In reply to comment #0)
 Recently found this one in my GSOC project. As this involves compilation of
 regex at CTFE, I'm not yet able to produce small test case.
 
 dmd spits this:
 ..\..\fred.d(2020): Error: CTFE internal error: illegal stack value stack
 
 Assertion failure: 'isStackValueValid(newval)' on line 5452 in file
 'interpret.c'
 
 abnormal program termination
 
 But anyway, what kind of situation is supposed to trigger that assert?

Any kind of CTFE assignment involving a non-reference type, that wasn't tested.
The few lines involving the variable 'stack' around line 2020 will be the only
ones involved in the bug.

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


[Issue 6507] [2.055 beta] ICE: var Internal error: backend\cgcs.c 319

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6507


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #2 from Nick Sabalausky cbkbbej...@mailinator.com 2011-08-16 
20:15:51 PDT ---
This was an artifact of the invalid issue 6509

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


[Issue 6509] [2.055 beta] ICE when compiling druntime or phobos

2011-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6509


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

   What|Removed |Added

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


--- Comment #3 from Don clugd...@yahoo.com.au 2011-08-16 22:11:52 PDT ---
(In reply to comment #2)
 Turns out DMD's makefile was failing to properly detect it needed to re-build
 something, because when I deleted all the files the build process generated,
 the resulting DMD compiled druntime and phobos successfully.

Yeah, there are a lot of missing header file dependencies in the makefile. I
always run 'make clean' before building if I've modified a header file.

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