[Issue 3422] Structs with default initializers bigger than register size cannot be default parameters

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3422


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

   What|Removed |Added

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


--- Comment #1 from Don clugd...@yahoo.com.au 2009-10-20 02:09:16 PDT ---
This is the same as

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


[Issue 3422] ICE(cgcod.c) Structs with default initializers bigger than register size cannot be default parameters

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3422


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

   What|Removed |Added

   Keywords||ice-on-valid-code
Version|2.035   |1.020
Summary|Structs with default|ICE(cgcod.c) Structs with
   |initializers bigger than|default initializers bigger
   |register size cannot be |than register size cannot
   |default parameters  |be default parameters


--- Comment #2 from Don clugd...@yahoo.com.au 2009-10-20 02:13:11 PDT ---
This may have the same root cause as bug 2437 and bug 2935.
It also applies to D1, at least as far back as 1.020 (but didn't compile at all
in 1.010), so not a regression.

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


[Issue 3423] New: The Bartosz Blocker

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3423

   Summary: The Bartosz Blocker
   Product: D
   Version: 2.035
  Platform: All
OS/Version: All
Status: NEW
  Keywords: patch, wrong-code
  Severity: blocker
  Priority: P1
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2009-10-20 06:50:46 PDT ---
This landmine nearly cost us one of our top developers. Hours and hours to
track down, less than a minute to patch.

Reduced test case: compile with -H. The destructor and postblit don't get
copied to the header file. 
This doesn't generate any compile-time errors, but causes really weird
behaviour, including run-time crashes: the functions are present when compiled
into a library, but are missing when the library is used.

struct Foo
{
   int k;
   ~this() { k = 1; }
   this(this) { k = 2; }
}

PATCH: func.c line 2892 and 2800

void DtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
-   if (hgs-hdrgen)
-return;
buf-writestring(~this());
bodyToCBuffer(buf, hgs);
}

void PostBlitDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
-if (hgs-hdrgen)
-return;
-buf-writestring(=this());
+buf-writestring(this(this));
bodyToCBuffer(buf, hgs);
}

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


Re: [Issue 3423] Destructor and postblit don't get copied to the header file when using -H

2009-10-20 Thread Don

d-bugm...@puremagic.com wrote:

http://d.puremagic.com/issues/show_bug.cgi?id=3423


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

   What|Removed |Added

 CC||llu...@gmail.com
Summary|The Bartosz Blocker |Destructor and postblit
   ||don't get copied to the
   ||header file when using -H


--- Comment #1 from Leandro Lucarella llu...@gmail.com 2009-10-20 08:45:57 
PDT ---
I've taken the freedom to change the title because it was very informative
really. I hope you don't mind, but using a good title for the bug report help
people to find the correct bug and avoids duplicates and bug maintenance
overhead.


Actually, the new title is NOT more informative. Your title makes it 
sounds like this is innocuous. If I'd used your title, you probably 
wouldn't have noticed it... I'm worried it'll get lost now.




Thanks for the patch BTW :)



[Issue 3424] New: Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424

   Summary: Ref counting still doesn't work for std.stdio.File
   Product: D
   Version: 2.035
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: critical
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2009-10-20 09:22:29 PDT ---
If this can't be fixed in short order it should at least be documented so that
people don't rely on the ref counting and auto closing.  Here's a test case to
show it doesn't work.  This fails on both Windows and Linux.

import std.stdio, std.file;

void main() {
std.file.write(foo.txt, stuff);
foreach(i; 0..1_000_000) {
openStuff();  // Throws too many files error rather quickly.
}
}

void openStuff() {
File myFile = File(foo.txt);
// Not automatically closed.
}

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


[Issue 3425] New: std.stdio.File does not properly handle EOF from stdin on Windows

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3425

   Summary: std.stdio.File does not properly handle EOF from stdin
on Windows
   Product: D
   Version: 2.035
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2009-10-20 11:55:53 PDT ---
Code:

import std.stdio, std.algorithm;

void main(string[] args) {
auto foo = stdin.byLine();
foreach(elem; foo) {
writeln(elem);
}
}

Input file (foo.txt) :
foo
bar

Result:

F:\cat foo.txt | test2.exe
foo
bar
std.stdio.StdioException: Bad file descriptor

Works perfectly on Linux.  Haven't tested on Mac, BSD or whatever the heck else
DMD runs on lately.

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


[Issue 2364] ftell return type is long in C, that is 64-bit on x86-64

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2364


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

   What|Removed |Added

 CC||and...@metalanguage.com


--- Comment #7 from Andrei Alexandrescu and...@metalanguage.com 2009-10-20 
12:10:56 PDT ---
I'd like to replace the antiquated fseek/ftell routines with 64-bit routines
straight inside druntime. On Windows, there's _fseeki64:

http://msdn.microsoft.com/en-us/library/75yw9bf3%28VS.80%29.aspx

On Linux, there's fseeko64:

http://www.mkssoftware.com/docs/man3/fseek.3.asp

I couldn't find the appropriate OSX routine, and I wouldn't be able to test it
either. I know Sean is very busy, so may I get a hand from around here?

Ideally what I'd like to do would be to take care of whatever
forwarding/aliasing is needed inside druntime to make the normal fseek and
ftell routines use 64-bit ulong. (Sean approved.) Please let me know if you
could help, thanks!

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


[Issue 3426] New: ICE(optimize.c): struct literal with cast, as function default parameter.

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3426

   Summary: ICE(optimize.c): struct literal with cast, as function
default parameter.
   Product: D
   Version: 1.020
  Platform: All
OS/Version: Windows
Status: NEW
  Keywords: ice-on-valid-code, patch
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2009-10-20 12:17:43 PDT ---
An ancient bug: same ICE on D1.020 as on D2.036
TEST CASE:

struct Ashes {
int ashes = cast(int)0;
}
void funky (Ashes s = Ashes()) {}

void funk() {
   funky();
}


PATCH: This patch also fixes the closely related bug 3422.
 (The semantic is for this bug. The implicit cast is for bug 3422.
The assert is just a precaution).
expression.c line 3271.

{e = v-type-defaultInit();
e-loc = loc;
}
offset = v-offset + v-type-size();
}
+   assert(v-type);
+e= e-semantic(sc);
+if (e-type !=v-type) e = e-implicitCastTo(sc, v-type);
elements-push(e);
}

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


[Issue 3424] Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@metalanguage.com
 Resolution||FIXED


--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com 2009-10-20 
13:03:22 PDT ---
(In reply to comment #0)
 If this can't be fixed in short order it should at least be documented so that
 people don't rely on the ref counting and auto closing.  Here's a test case to
 show it doesn't work.  This fails on both Windows and Linux.
 
 import std.stdio, std.file;
 
 void main() {
 std.file.write(foo.txt, stuff);
 foreach(i; 0..1_000_000) {
 openStuff();  // Throws too many files error rather quickly.
 }
 }
 
 void openStuff() {
 File myFile = File(foo.txt);
 // Not automatically closed.
 }

I'm glad to report I just fixed this and committed stdio.d.

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


[Issue 3427] New: Chain doesn't work w/ arrays with immutable elements.

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3427

   Summary: Chain doesn't work w/ arrays with immutable elements.
   Product: D
   Version: 2.035
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: patch
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2009-10-20 14:03:13 PDT ---
import std.range;

void main() {
string a = foo;
string b = bar;
auto myChain = chain(a, b);
}

C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(937): Error:
this._input._field_field_0[index] isn't mutable
C:\dmd2\windows\bin\..\..\src\phobos\std\range.d(937): Error:
this._input._field_field_1[index] isn't mutable

The fix is to test for immutability in the static if statement on line 930 of
std.range:

static if (allSameType  is(typeof(_input.field[0][0] = ElementType.init)))

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


[Issue 3428] New: OSX 10.6.1 Access violation when writing to global variables

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3428

   Summary: OSX 10.6.1 Access violation when writing to global
variables
   Product: D
   Version: 1.050
  Platform: x86_64
OS/Version: Mac OS X
Status: NEW
  Severity: critical
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: digitalm...@chrisoneill.co.uk


--- Comment #0 from Christopher O'Neill digitalm...@chrisoneill.co.uk 
2009-10-20 14:40:22 PDT ---
DMD v1.050 (using pre-build binary)
gcc version 4.2.1 (Apple Inc. build 5646)
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-95.2.12
DMD is creating a Mach-O executable i386

D source:

int q;
void main()
{
q = 1;   // NB: Access violation occurs on WRITE only
}

Dump of assembler code for function _Dmain:
0x287c _Dmain+0:push   %ebp
0x287d _Dmain+1:mov%esp,%ebp
0x287f _Dmain+3:call   0x2884 _Dmain+8
0x2884 _Dmain+8:pop%eax
0x2885 _Dmain+9:mov0x1d0d0(%eax),%ecx
0x288b _Dmain+15:movl   $0x1,(%ecx)  -- Access Violation here
0x2891 _Dmain+21:xor%eax,%eax
0x2893 _Dmain+23:pop%ebp

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x2f10
0x288b in _Dmain ()

(gdb) x 0x2f10
0x2f10 D6object6Object14notifyRegisterMFDFC6ObjectZvZv:0x83ec8b55

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


[Issue 3427] Chain doesn't work w/ arrays with immutable elements.

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3427


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

   What|Removed |Added

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


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


[Issue 3421] Inline assembler problems accessing static variables

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3421



--- Comment #2 from Graham grahamc00...@yahoo.co.uk 2009-10-20 15:29:29 PDT 
---
Thanks.

Is there any way to put __gshared or immutable into a typedef or alias so that
conditional compilation can allow code to compile with both DMD v1 and DMD v2 ?

I thought something like this would do it:

import std.stdio;

static __gshared uint value1 = 3;
static immutable uint value2 = 4;

version(D_Version2) {
mixin(typedef static __gshared uint __gshared_uint;);
mixin(typedef static immutable uint immutable_uint;);
}
else {
typedef static uint __gshared_uint;
typedef static uint immutable_uint;
}

__gshared_uint value3 = 5;
immutable_uint value4 = 6;

void main() {
uint save1, save2, save3, save4;
asm {
movEAX,value1;
movsave1,EAX;
movEAX,value2;
movsave2,EAX;
movEAX,value3;
movsave3,EAX;
movEAX,value4;
movsave4,EAX;
}
writefln(save1 %d save2 %d save3 %d save4 %d, save1, save2, save3,
save4);
}

but it does not:
dmd -vtls test03
test03.d(15): value3 is thread local
test03.d(16): value4 is thread local

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


[Issue 3424] Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424


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

   What|Removed |Added

 CC||llu...@gmail.com


--- Comment #2 from Leandro Lucarella llu...@gmail.com 2009-10-20 17:29:50 
PDT ---
Your commit, r1300, also removes some opSlice():

@@ -736,10 +740,4 @@

 /// Range primitive implementations.
-ByLine!(Char, Terminator) opSlice()
-{
-return this;
-}
-
-/// Ditto
 bool empty() const
 {


Is this intended? If so, it would be nice if you could apply the changes in two
different commits (if they are really unrelated, as I think they are; if not,
please ignore this comment :).

I'm sorry to say this here I guess it's not the place, but I don't know of a
better place.

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


[Issue 3424] Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424



--- Comment #3 from Andrei Alexandrescu and...@metalanguage.com 2009-10-20 
17:38:19 PDT ---
(In reply to comment #2)
 Your commit, r1300, also removes some opSlice():
 
 @@ -736,10 +740,4 @@
 
  /// Range primitive implementations.
 -ByLine!(Char, Terminator) opSlice()
 -{
 -return this;
 -}
 -
 -/// Ditto
  bool empty() const
  {
 
 
 Is this intended? If so, it would be nice if you could apply the changes in 
 two
 different commits (if they are really unrelated, as I think they are; if not,
 please ignore this comment :).
 
 I'm sorry to say this here I guess it's not the place, but I don't know of a
 better place.

For a brief period, Walter required opSlice for foreach to work. He
subsequently changed that, so I clean up that stuff when I get the opportunity.

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


[Issue 3424] Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424



--- Comment #4 from Leandro Lucarella llu...@gmail.com 2009-10-20 17:50:14 
PDT ---
(In reply to comment #3)
 (In reply to comment #2)
  Your commit, r1300, also removes some opSlice():
  
  @@ -736,10 +740,4 @@
  
   /// Range primitive implementations.
  -ByLine!(Char, Terminator) opSlice()
  -{
  -return this;
  -}
  -
  -/// Ditto
   bool empty() const
   {
  
  
  Is this intended? If so, it would be nice if you could apply the changes in 
  two
  different commits (if they are really unrelated, as I think they are; if 
  not,
  please ignore this comment :).
  
  I'm sorry to say this here I guess it's not the place, but I don't know of a
  better place.
 
 For a brief period, Walter required opSlice for foreach to work. He
 subsequently changed that, so I clean up that stuff when I get the 
 opportunity.

Ok, that comment would be an excellent commit message for a separated commit
removing the opSlice() ;)

Thanks for the clarification.

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


[Issue 3429] New: Core dump on passing template literal to member function.

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3429

   Summary: Core dump on passing template literal to member
function.
   Product: D
   Version: 2.035
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2009-10-20 18:22:13 PDT ---
struct Foo {
void doStuff(alias fun)() {}
}

void main() {
Foo foo;
foo.doStuff!( (i) { return i; })();
}

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


[Issue 3424] Ref counting still doesn't work for std.stdio.File

2009-10-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3424


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

   What|Removed |Added

 CC||bra...@puremagic.com


--- Comment #5 from Brad Roberts bra...@puremagic.com 2009-10-20 18:26:12 PDT 
---
The two @@BUG@@ comments that are still there.. is there still a bug?  If so,
what is the bug number?

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