[Issue 5573] New: Compiler (not linker) should generate an error for missing main()

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5573

   Summary: Compiler (not linker) should generate an error for
missing main()
   Product: D
   Version: D1  D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2011-02-14 02:09:54 PST ---
The standard linker error is (a) newbie-hostile; and 
(b) on Windows, it generates an invalid executable. Running this executable
seems to cause an infinite loop you cannot break out of.

As Walter said on the newsgroup, it's not possible to solve this in general:
 The problem is the main() can come from a library, or some other .obj 
 file handed to the compiler that the compiler doesn't look inside. It's 
 a very flexible way to build things, and trying to impose more order on 
 that will surely wind up with complaints from some developers.

But, it's only the trivial case that matters.
The compiler should generate an error if all files passed to the compiler are
.d/.di files, and there is no use of pragma(lib).
Error can be something like:
No main function, and no .obj or .lib file which could contain one.

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


[Issue 5573] Compiler (not linker) should generate an error for missing main()

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5573


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #1 from bearophile_h...@eml.cc 2011-02-14 04:04:23 PST ---
See also bug 5215, bug 4680

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


D2 dynamic array on Win32 exception

2011-02-14 Thread Gleb
Hello,

void main()
{
int[][5] a;
a[0][0] = 1;
}

Compiling this code compiler (D 2.051, Win32) generates an error:
core.exception.RangeError@aaa(4): Range violation

With D v.1 it's all rigth. I guess it's a bug in D v.2


Re: D2 dynamic array on Win32 exception

2011-02-14 Thread bearophile
Gleb:

 void main()
 {
   int[][5] a;
   a[0][0] = 1;
 }
 
 Compiling this code compiler (D 2.051, Win32) generates an error:
 core.exception.RangeError@aaa(4): Range violation
 
 With D v.1 it's all rigth. I guess it's a bug in D v.2

Are you sure it is not a bug on D1?
For further posts, I suggest you the D.learn newsgroup.

Bye,
bearophile


[Issue 2846] box arguments should be const

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2846


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

   What|Removed |Added

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


--- Comment #3 from Don clugd...@yahoo.com.au 2011-02-14 05:17:38 PST ---
This makes no sense: a bug that applies only to D1, that involves a D2
feature...

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


[Issue 2874] phobos docs issues

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2874


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #2 from Lars T. Kyllingstad bugzi...@kyllingen.net 2011-02-14 
05:47:35 PST ---
https://github.com/D-Programming-Language/phobos/commit/efcacab6ec2876e8e748090ad585edee3bca0c6b

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


[Issue 4464] std.range.take does not always return Take!R

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4464


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED


--- Comment #4 from Lars T. Kyllingstad bugzi...@kyllingen.net 2011-02-14 
05:49:07 PST ---
https://github.com/D-Programming-Language/phobos/commit/3948e3f61403bd7618913c36959158018970011d

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


[Issue 4807] Examples for std.array insert and replace

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4807


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


--- Comment #1 from Lars T. Kyllingstad bugzi...@kyllingen.net 2011-02-14 
05:48:20 PST ---
https://github.com/D-Programming-Language/phobos/commit/00e78b8dd24f37589b0121831c8e19011425bb77

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


[Issue 5271] Not constant RAND_MAX

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5271


Lars T. Kyllingstad bugzi...@kyllingen.net changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #4 from Lars T. Kyllingstad bugzi...@kyllingen.net 2011-02-14 
05:50:02 PST ---
https://github.com/D-Programming-Language/druntime/commit/1006fa114e48147a338f6cee3a0cadfe17e59218

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


Re: D2 dynamic array on Win32 exception

2011-02-14 Thread Gleb
Bearophile:

Are you sure it is not a bug on D1?
For further posts, I suggest you the D.learn newsgroup.

Bearophile,
Thank you for the answer. I'll try D.learn.


[Issue 5574] New: Error: this for ~this needs to be type foo not type foo[1u][1u]

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5574

   Summary: Error: this for ~this needs to be type foo not type
foo[1u][1u]
   Product: D
   Version: D2
  Platform: All
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: pun...@coverify.org


--- Comment #0 from Puneet Goel pun...@coverify.org 2011-02-14 06:59:24 PST 
---
I am using version 2.051 of the dmd compiler.

I am getting this error when I am instantiating a struct array with a
single element inside another class and only if there is the
destructor for the struct is explicitly defined. Is it a known error?

Here is a minimized snippet that gives error:

$ rdmd --main -unittest test.d
Error: this for ~this needs to be type foo not type foo[1u][1u]
Error: this for ~this needs to be type foo not type foo[1u]


// test.d

struct foo {
 int foofoo;
 ~this() { // no error if explicit destructor not
   // defined
 }
}

class bar {
 foo fred;
 foo[2][2] foofoo;
 foo[1] frop;  // this gives error
 foo[1][1] fropfrop;   // this too
}

unittest {
 foo frop;
 foo[1][1] fropfrop;   // this works
 bar burp;
}

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


[Issue 5575] New: Problem with a map() of a const uniq()

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5575

   Summary: Problem with a map() of a const uniq()
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-02-14 11:03:24 PST ---
D2 code. map() doesn't modify the input range, so I think this is correct (but
I am not sure if it's correct. A mutable range of immutable items isn't the
same thing as an immutable range):


import std.algorithm;
void main() {
auto u1 = uniq([1]);
auto m1 = map!q{ a }(u1); // OK
const u2 = u1;
auto m2 = map!q{ a }(u2); // Error
}


DMD 2.051 gives:

...\dmd\src\phobos\std\algorithm.d(109): Error: constructor
std.algorithm.Map!(result,const(Uniq!(pred,int[]))).Map.this (Uniq!(pred,int[])
input) is not callable using argument types (const(Uniq!(pred,int[])))
...\dmd\src\phobos\std\algorithm.d(109): Error: cannot implicitly convert
expression (r) of type const(Uniq!(pred,int[])) to Uniq!(pred,int[])
test4.d(6): Error: template instance std.algorithm.map!( a
).map!(const(Uniq!(pred,int[]))) error instantiating

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


[Issue 5576] New: Problem with map() that yields Tuples

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5576

   Summary: Problem with map() that yields Tuples
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-02-14 11:15:51 PST ---
import std.algorithm, std.typecons;
struct Foo1 { int x; }
alias Tuple!(int) Foo2;
void main() {
auto m1 = map!((int x){ return Foo1(x); })([1, 2]); // OK
auto m2 = map!((x){ return Foo2(x); })([1, 2]); // OK
auto m3 = map!((int x){ return Foo2(x); })([1, 2]); // Error
}


DMD 2.051 prints this error message that I don't understand:
test.d(7): Error: cannot implicitly convert expression (0) of type int to
Tuple!(int)

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


[Issue 5577] New: Incorrectly generated di file with extern (C) and alias

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5577

   Summary: Incorrectly generated di file with extern (C) and
alias
   Product: D
   Version: D1
  Platform: Other
OS/Version: Mac OS X
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: d...@me.com


--- Comment #0 from Jacob Carlborg d...@me.com 2011-02-14 11:52:15 PST ---
The following D file:

module main;

void main ()
{
alias extern (C) void function () f;
}

Compiled with dmd -H main.d produces this D interface file:

// D import file generated from 'main.d'
module main;
void main()
{
extern (C) alias void function() f;

}

When compiling the interface file I get the following errors:

main.di(5): basic type expected, not alias
main.di(5): no identifier for declarator int
main.di(5): semicolon expected to close declaration, not 'alias'

This is using dmd 1.066.

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


[Issue 5573] Compiler (not linker) should generate an error for missing main()

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5573


Robert Clipsham rob...@octarineparrot.com changed:

   What|Removed |Added

 CC||rob...@octarineparrot.com


--- Comment #2 from Robert Clipsham rob...@octarineparrot.com 2011-02-14 
21:03:52 GMT ---
Another possibility for this (and other linker errors) - given that dmd invokes
the linker, its stderr could be redirected and filtered. The compiler can then
give a nice error for a missing main() function, and also demangle symbol names
without the linker needing modification. This avoids the issue of main() being
in a library, but is also a bit more hacky.

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


[Issue 5578] New: GDC: struct is wrong size when real data type used.

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5578

   Summary: GDC: struct is wrong size when real data type used.
   Product: D
   Version: D1
  Platform: x86
OS/Version: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: brad.lanam.t...@gmail.com


--- Comment #0 from Brad L brad.lanam.t...@gmail.com 2011-02-14 14:45:22 PST 
---
Works w/dmd1, gdc2, dmd2.
Fails w/gdc1.

struct C_ST_y
 {
 double c;
 real d;
 } ;
//static assert ((C_ST_y).sizeof == 20);

void main () {
 writefln (y:%d, C_ST_y.sizeof);
 writefln (y.c:s:%d, C_ST_y.c.sizeof);
 writefln (y.d:s:%d, C_ST_y.d.sizeof);
 writefln (y.c:o:%d, C_ST_y.c.offsetof);
 writefln (y.d:o:%d, C_ST_y.d.offsetof);
}

y:24
y.c:s:8
y.d:s:12
y.c:o:0
y.d:o:8

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


[Issue 5578] GDC: struct is wrong size when real data type used.

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5578



--- Comment #1 from Brad L brad.lanam.t...@gmail.com 2011-02-14 14:48:33 PST 
---
gdc (Ubuntu 1:1.046-4.3.4-3ubuntu1) 4.3.4

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


[Issue 5578] GDC: struct is wrong size when real data type used.

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5578


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bra...@puremagic.com
 Resolution||INVALID


--- Comment #2 from Brad Roberts bra...@puremagic.com 2011-02-14 15:07:33 PST 
---
gdc bugs should be filed over here:

   https://bitbucket.org/goshawk/gdc/issues?status=newstatus=open

The project home page:

   https://bitbucket.org/goshawk/gdc/wiki/Home

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


[Issue 5579] New: Segfault on first call to GC after starting new thread

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5579

   Summary: Segfault on first call to GC after starting new thread
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2011-02-14 17:46:30 PST ---
The following code segfaults on about 50% of runs.  This happens in both 32-bit
and 64-bit Linux and on Windows, regardless of how the -O, -inline, and
-release flags are set.

import core.memory, core.thread;

void doNothing() {}

void main() {
auto t = new Thread(doNothing);
t.start;
GC.collect();
}

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


[Issue 5581] New: [64-bit] Wrong code with bitwise operations on bools

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5581

   Summary: [64-bit] Wrong code with bitwise operations on bools
   Product: D
   Version: D2
  Platform: x86_64
OS/Version: Windows
Status: NEW
  Keywords: wrong-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha dsim...@yahoo.com 2011-02-14 20:10:25 PST ---
The following code produces obviously implausible results on 64-bit builds. 
result ends up being bigger than 0b111, which is the biggest number that
correct code could generate here.  (The correct value, which 32-bit builds
produce, is 3.)  This only happens in this test case when -O and -release are
disabled, though I think it still happens with -O and -release enabled in the
program I reduced this bug from.

import std.stdio;

void screwy(string[] data) {
immutable size_t mid = data.length / 2;
immutable uint result = ((cast(uint) (data[0]  data[mid]))  2) |
((cast(uint) (data[0]  data[$ - 1]))  1) |
(cast(uint) (data[mid]  data[$ - 1]));

stderr.writefln(%b, result);
}

void main() {
auto stuff = [a, a, b];
screwy(stuff);
}

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


[Issue 5579] Segfault on first call to GC after starting new thread

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5579


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

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2011-02-14 
21:31:23 PST ---
It faults on this code in druntime/src/rt/lifetime.d:
==
// we expect this to be called with the lock in place
extern(C) void rt_processGCMarks(void[] tls)
{
// called after the mark routine to eliminate block cache data when it
// might be ready to sweep

debug(PRINTF) printf(processing GC Marks, %x\n, tls.ptr);
auto cache = *cast(BlkInfo **)(tls.ptr + __blkcache_offset);
   ^^^
=
Both tls.ptr and __blkcache_offset are NULL.

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


[Issue 5582] New: Improvements to the DLL startup code

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5582

   Summary: Improvements to the DLL startup code
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2011-02-14 23:09:54 
PST ---
Created an attachment (id=909)
DLL startup improvements

I have a few improvements to the startup code to DLLs:

1. Make the TLS patch work under Windows Server 2003 and XP/64

2. On a 64-bit OS, there sometimes seem to exist threads that don't have any
TLS set up, so ignore these threads, assuming they are low level system
threads.

3. improve TLS setup of already existing threads by not only switching the TLS
entry of the current DLL, but simply the full TLS array of the current thread.

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


[Issue 5583] New: Issues when creating a debug build of druntime library

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5583

   Summary: Issues when creating a debug build of druntime library
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2011-02-14 23:22:30 
PST ---
Created an attachment (id=910)
patch for issues with debug builds of druntime

There are a few issues that you might hit when building a debug build of
druntime. Sorry, if these issues should be in separate reports, but I did not
want to bother everybody with multiple report on these non-urgent changes:

1. The GC invariants in gc.gcx are not thread safe, so I suggest to enable them
only with a separate debug identifier or use one of the existing identifiers.

2. _d_arraycopy always prints debug messages, I guess this should also get some
debug(PRINTF) condition.

3. _d_framehandler and _d_local_unwind assert with a range violation if they
have to unwind more than entry from the handler table. This happens because the
struct DHandlerTable uses a place holder array of length 1, but actually
expands beyond that. The patch takes a pointer to the array to avoid the range
check.

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


[Issue 5582] Improvements to the DLL startup code

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5582



--- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2011-02-14 23:32:25 
PST ---
Created an attachment (id=911)
missing change from previous patch

Sorry, missed this change. (Is there a way to get a single patch across
multiple commits from git?).

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


[Issue 5401] std.socket updates and boost license

2011-02-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5401


Daniel Gibson metalcae...@gmail.com changed:

   What|Removed |Added

 CC||metalcae...@gmail.com


--- Comment #3 from Daniel Gibson metalcae...@gmail.com 2011-02-14 23:42:04 
PST ---
This is great, thanks!
When this code is accepted http://d.puremagic.com/issues/show_bug.cgi?id=4234
can be closed.

If additional work is done for a review process etc, may I suggest to add
support for IPv6 (Internet6Address?) and local addresses (AF_UNIX) as well
(also a function like socketpair() would go nice with that)?

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