[Issue 3544] optlink termination 0041338f with recursive nested functions

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3544


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #10 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
02:03:52 PST ---
The test case is crashing in dmd, not optlink. It's a stack overflow.

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


[Issue 3551] nested struct = dmd adds a hidden pointer

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3551


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
02:22:08 PST ---
Declaring the struct as static should work, I'll make that fix.

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


[Issue 3478] no effect in expression error on return to void

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3478



--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
02:31:19 PST ---
I'll change the spec to say that it's illegal to have a void return expression
with no side effects.

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420


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

   What|Removed |Added

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


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
02:36:43 PST ---
Paths are not allowed in the string supplied to the import statement. This is
for security reasons. To get the example to compile, use:

import (data.txt);

and use the switch:

-Jdir

This behavior is as intended.

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420


Vladimir thecybersha...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WONTFIX |


--- Comment #2 from Vladimir thecybersha...@gmail.com 2009-11-30 02:40:45 PST 
---
That's fine and dandy, except it doesn't work either:

C:\Temp\D\Bug3420 dir
 Volume in drive C is WS2008X64
 Volume Serial Number is 4CC8-8E34

 Directory of C:\Temp\D\Bug3420

2009.11.30  12:38DIR  .
2009.11.30  12:38DIR  ..
2009.11.30  12:38DIR  dir
2009.11.30  12:3838 test.d
   1 File(s) 38 bytes
   3 Dir(s)  11,197,788,160 bytes free

C:\Temp\D\Bug3420 dir dir
 Volume in drive C is WS2008X64
 Volume Serial Number is 4CC8-8E34

 Directory of C:\Temp\D\Bug3420\dir

2009.11.30  12:38DIR  .
2009.11.30  12:38DIR  ..
2009.11.30  12:38 4 data.txt
   1 File(s)  4 bytes
   2 Dir(s)  11,197,788,160 bytes free

C:\Temp\D\Bug3420 cat test.d
const data = import(dir/data.txt);

C:\Temp\D\Bug3420 dmd -Jdir test.d
test.d(1): Error: use -Jpath switch to provide path for filename dir/data.txt

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


[Issue 3481] PATCH: opPow(), x ^^ y as a power operator

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3481



--- Comment #10 from Sobirari Muhomori dfj1es...@sneakemail.com 2009-11-30 
07:01:11 PST ---
(In reply to comment #4)
 I'm sorry to bring the bike shed discussion here, but I would like to consider
 ** exponentiation. The reason is that writing ^^ for people with keyboards 
 with
 dead keys (to write accents for example) is very hard, because you have to
 write ^ like this: shift+6 space (3 keystrokes), or even worse (unless you
 use Emacs ;): shift+alt_gr+6.

If remeber it correctly, you don't have to type space in this case, just hit
shift+6 two times. Yes, the first hit will be the dead key hit, but the second
will yield ^^ at once.

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


[Issue 3559] New: DMD 1.048+ fails to take function pointer from overloaded member functions

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3559

   Summary: DMD 1.048+ fails to take function pointer from
overloaded member functions
   Product: D
   Version: 1.051
  Platform: All
OS/Version: All
Status: NEW
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: klickver...@gmail.com


--- Comment #0 from klickver...@gmail.com 2009-11-30 08:08:06 PST ---
The following code compiles and works fine on DMD 1.047 and older (DMD 1.023
was the earliest one I tested), but no longer compiles with DMD 1.048 up to DMD
1.052 because the compiler cannot »choose« the correct overload when it tries
to create the delegate/function pointer. In older versions, the casts were
enough of a hint.

Note, however, that the code compiles without any errors if the overload I try
to get the address of is the last one declared – in the example below, getting
the address of »void foo( float a )« would work fine.

---

template addressOf( alias fn, Type ) {
  const addressOf = cast( Type )fn;
}

class A {
  void foo( float a ) {}
  void foo( int a ) {}

  void bar() {
void* dg = addressOf!( foo, void function( float ) );
auto blah = cast( void delegate( float ) )foo;
if ( cast( void* )blah.funcptr == dg ) {
  // Stdout( not overridden ).newline;
} else {
  // Stdout( overridden ).newline;
}
  }
}

class B : A {
  override void foo( float a ) {}
  override void foo( int a ) {}
}

void main() {
  A a = new A();
  a.bar;

  A b = new B();
  b.bar;
}

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


[Issue 3560] New: foreach on closure corrupted

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3560

   Summary: foreach on closure corrupted
   Product: D
   Version: 2.036
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: kovrov+purema...@gmail.com


--- Comment #0 from Serg Kovrov kovrov+purema...@gmail.com 2009-11-30 
09:44:23 PST ---
import std.stream: File;
import std.stdio: writefln;

void outer()
{
auto auth_file = new File(path-to-existing-file);
writefln(outer: 0x%X, auth_file);

int inner(int delegate(ref ubyte[]) dg)
{
writefln(inner: 0x%X, auth_file);
return 0;
}

foreach (entry; inner)
{
//...
}
}

void main()
{
outer();
}



expected output:
 outer: 0xB7D19E44
 inner: 0xB7D19E44

actual output:
outer: 0xB7D19E44
inner: 0x4

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


[Issue 3561] New: math.abs signature accepts static arrays, but errors internally.

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3561

   Summary: math.abs signature accepts static arrays, but errors
internally.
   Product: D
   Version: 2.036
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: diagnostic, patch
  Severity: enhancement
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: sandf...@jhu.edu


--- Comment #0 from Rob Jacques sandf...@jhu.edu 2009-11-30 13:10:14 PST ---
I ran into this while converting a Vector struct to the new value type static
arrays. Essentially, float[3] x; x.abs; Errors inside of the abs function. The
simple solution is to add !isArray!Num to the list of template constraints.
However, since I feel it's useful, I've also included a patch to add support
for static arrays to the abs function.

/***
 * Calculates the absolute value
 *
 * For complex numbers, abs(z) = sqrt( $(POWER z.re, 2) + $(POWER z.im, 2) )
 * = hypot(z.re, z.im).
 */
pure nothrow Num abs(Num)(Num x)
if (is(typeof(Num.init = 0))  is(typeof(-Num.init)) 
!isDynamicArray!Num 
!(is(Num* : const(ifloat*)) || is(Num* : const(idouble*))
|| is(Num* : const(ireal*
{
static if (isFloatingPoint!(Num))
return fabs(x);
else static if(isStaticArray!Num) {
typeof(return) a;
foreach(i,ref b; a)
b = abs(x[i]);
return a;
} else
return x=0 ? x : -x;
}

pure nothrow auto abs(Num)(Num z)
if (is(Num* : const(cfloat*)) || is(Num* : const(cdouble*))
|| is(Num* : const(creal*)))
{
return hypot(z.re, z.im);
}

/** ditto */
pure nothrow real abs(Num)(Num y)
if (is(Num* : const(ifloat*)) || is(Num* : const(idouble*))
|| is(Num* : const(ireal*)))
{
return fabs(y.im);
}


unittest
{
assert(isIdentical(abs(-0.0L), 0.0L));
assert(isNaN(abs(real.nan)));
assert(abs(-real.infinity) == real.infinity);
assert(abs(-3.2Li) == 3.2L);
assert(abs(71.6Li) == 71.6L);
assert(abs(-56) == 56);
assert(abs(2321312L)  == 2321312L);
assert(abs(-1+1i) == sqrt(2.0));
assert(abs([-1,-2,-3]) == [1,2,3]);
}

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420



--- Comment #4 from Vladimir thecybersha...@gmail.com 2009-11-30 14:01:19 PST 
---
Ah, I see. This should be clarified in the documentation... Also, doesn't
anyone think that this could be too constricting? What if you have a directory
tree of data to import? Not to mention not being able to import two files with
the same filename but from different directories...

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


[Issue 3481] PATCH: opPow(), x ^^ y as a power operator

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3481


Leandro Lucarella llu...@gmail.com changed:

   What|Removed |Added

 CC||llu...@gmail.com


--- Comment #11 from Leandro Lucarella llu...@gmail.com 2009-11-30 14:01:10 
PST ---
(In reply to comment #10)
 (In reply to comment #4)
  I'm sorry to bring the bike shed discussion here, but I would like to 
  consider
  ** exponentiation. The reason is that writing ^^ for people with keyboards 
  with
  dead keys (to write accents for example) is very hard, because you have to
  write ^ like this: shift+6 space (3 keystrokes), or even worse (unless you
  use Emacs ;): shift+alt_gr+6.
 
 If remeber it correctly, you don't have to type space in this case, just hit
 shift+6 two times. Yes, the first hit will be the dead key hit, but the second
 will yield ^^ at once.

Not with my keyboard configuration, I can hit Shift+6 twice, but that yields
only one ^, so I have to press Shift+6 four times to get ^^ :)

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420



--- Comment #5 from Leandro Lucarella llu...@gmail.com 2009-11-30 14:10:12 
PST ---
(In reply to comment #4)
 Ah, I see. This should be clarified in the documentation... Also, doesn't
 anyone think that this could be too constricting?

I do.

Maybe this can be changed to be a feature request. I really can't see how
allowing subdirectories can be a security risk, you only have to check that the
canonical name of the imported file is still in a subdirectory of an -J'ed
directory.

In POSIX you can use realpath(3) to get the canonical name of a file, then just
check if the imported canonical name starts with any -J directory canonical
name.

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


[Issue 3521] Optimized code access popped register

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3521


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
14:16:29 PST ---
I've found the cause of the problem; it's when a registered variable is on both
sides of an operator and the right side tries to modify the variable. The fix
isn't easy, I'll work on it.

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


[Issue 3562] New: Static Array ops create duplicate method definitions

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3562

   Summary: Static Array ops create duplicate method definitions
   Product: D
   Version: 2.036
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: link-failure
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: sandf...@jhu.edu


--- Comment #0 from Rob Jacques sandf...@jhu.edu 2009-11-30 14:40:28 PST ---
The array ops generated for static arrays appear to trigger Issue 2703/2789 (or
something similar). I'm filling a separate issue as fixing Issue 2703/2789,
would simply convert the linking error to a compiling error.

-- goodbye.d
void foo() {
float[3] a = [-1,-2,-3];
float[3] b;
b[] = -a[];
}
- hello.d
import goodbye;

void main(string[] args) {
float[3] a = [-1,-2,-3];
float[3] b;
b[] = -a[];
}
 Error
Previous Definition Different : __arraySliceNegSliceAssign_f|

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420



--- Comment #7 from Leandro Lucarella llu...@gmail.com 2009-11-30 16:51:47 
PST ---
Created an attachment (id=521)
Test cases

Here are some test cases, they are packed in a tarball because it includes a
directory structure.

Tests are in the directory d2, and they should be compiled in that directory.
The tests have a small comment indicating what -J should be used to compile
(other -J options should fail).

You can test them all with this simple bash script (run it in the d2
directory):
for f in test{1..7}.d
do
for j in . ..
do
echo -n $f: ; head -n1 $f
dmd -J$j $f  ./`basename $f .d`
done
done

You have to go through the results and check them visually, the script can be
improve to make the verification automatically.

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


[Issue 3420] Impossible to specify -J path for subdirectories

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3420



--- Comment #8 from Leandro Lucarella llu...@gmail.com 2009-11-30 16:54:59 
PST ---
BTW, the patch I consider the patch only a proof of concept because it lacks
Windows support (and testing on other unixes). Besides that, I think the patch
is not bad =)

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


[Issue 3558] Optimizer bug results in false if condition being taken

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3558


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2009-11-30 17:15:12 PST ---
Reduced test case only requires -O. It's a bit peculiar.

int main()
{
long[1] c = [0]; // must be long

int [1] d = [1];
int k = 0;
if (!d[0]) 
   k = 1;   
k = d[0] + k + k;

if (c[0]) assert(c[0]);

return k;
}

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


[Issue 3558] Optimizer bug results in false if condition being taken

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3558


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
17:36:08 PST ---
Fixed changeset 272.

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


[Issue 3558] Optimizer bug results in false if condition being taken

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3558



--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2009-11-30 
17:39:13 PST ---
Oops, I meant 3521 was fixed!

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


[Issue 2478] std.math.poly Should be const-correct.

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2478


David Simcha dsim...@yahoo.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from David Simcha dsim...@yahoo.com 2009-11-30 20:35:13 PST ---
Fixed a long time ago.

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


[Issue 2504] Reserve for associative arrays

2009-11-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2504



--- Comment #3 from ZY Zhou rin...@gmail.com 2009-11-30 21:24:04 PST ---
(In reply to comment #2)
 No, this is because, on the second run, the program has already reserved a
 bunch of memory from the OS, so the GC doesn't run as often.

try this:

import std.stdio;
void main(){
 int[int] a;
 foreach(i;0..20_000_000){
  a[i] = i;
  if((i0x) == 0) writeln(i);
 }
}

You can see how slow it becomes when AA is large.
I don't think memory allocation could take so much time.

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