[Issue 6669] Compiler seg fault when using square brackets in inline assembly

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6669



--- Comment #2 from Peter Alexander peter.alexander...@gmail.com 2011-09-18 
09:43:39 PDT ---
My environment is:

$ uname -a
Darwin poita.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT
2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386

Unfortunately, I don't get any symbols from gdb, even when I rebuild dmd with
-ggdb

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xd39bf756
0x000b8188 in ?? ()
(gdb) bt
#0  0x000b8188 in ?? ()
#1  0x000bb861 in ?? ()
#2  0x000bc3df in ?? ()
#3  0x0010d98f in ?? ()
#4  0x0009e3ac in ?? ()
#5  0x000cfc92 in ?? ()
#6  0x000cc7a2 in ?? ()
#7  0x276d in receive_samples ()
#8  0x269c in receive_samples ()

I'm not very familiar with gdb, so if you have any tips to get a good stack
trace then please let me know how.

Interestingly, if I get the latest from trunk and build then I don't get this
error. Also, even when I checked out tag 2.055 I didn't get the error...
strange. Seems to only be the released version. Can you try that?

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


[Issue 5004] show both resolved symbols and original identifier in error messages involving aliases

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5004



--- Comment #6 from bearophile_h...@eml.cc 2011-09-18 11:14:04 PDT ---
GCC too uses aka in error messages:


#include stdint.h
struct S { int16_t x; };
int main(int argc, char **argv) {
S s = { argc };
return 0;
}


...g++ -std=c++0x temp.cpp -o temp
temp.cpp: In function 'int main(int, char**)':
temp.cpp:4:18: error: narrowing conversion of 'argc' from 'int' to 'int16_t
{aka short int}' inside { } [-fpermissive]

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


[Issue 5555] Built-in associative arrays in pure nothrow functions

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=


bearophile_h...@eml.cc changed:

   What|Removed |Added

Summary|built-in associative|Built-in associative arrays
   |array's length is not   |in pure nothrow functions
   |nothrow |


--- Comment #2 from bearophile_h...@eml.cc 2011-09-18 11:39:35 PDT ---
Currently associative arrays can't be used much in pure nothrow functions:

void main() pure nothrow {
int[int] aa;
aa.rehash;
auto L = aa.length;
auto x = aa.get(0, 10);
auto k = aa.keys;
auto v = aa.values;
auto bk = aa.byKey();
auto bv = aa.byValue();
}


DMD 2.055 gives:

test.d(3): Error: pure function 'main' cannot call impure function 'rehash'
test.d(4): Error: pure function 'main' cannot call impure function 'length'
test.d(5): Error: pure function 'main' cannot call impure function 'get'
test.d(6): Error: pure function 'main' cannot call impure function 'keys'
test.d(7): Error: pure function 'main' cannot call impure function 'values'
test.d(8): Error: pure function 'main' cannot call impure function 'byKey'
test.d(9): Error: pure function 'main' cannot call impure function 'byValue'
test.d(3): Error: aa.rehash is not nothrow
test.d(4): Error: aa.length is not nothrow
test.d(5): Error: aa.get is not nothrow
test.d(6): Error: aa.keys is not nothrow
test.d(7): Error: aa.values is not nothrow
test.d(8): Error: aa.byKey is not nothrow
test.d(9): Error: aa.byValue is not nothrow
test.d(1): Error: function D main 'main' is nothrow yet may throw

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


[Issue 6689] New: Pure std.exception.bailOut()

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6689

   Summary: Pure std.exception.bailOut()
   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-09-18 11:43:43 PDT ---
I suggest to add the pure annotation to the function std.exception.bailOut(),
so enforce() too gets inferred as pure.

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


[Issue 6690] New: Using lazy parameter is inferred as unsafe

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6690

   Summary: Using lazy parameter is inferred as unsafe
   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-09-18 15:25:16 PDT ---
We cannot use std.exception.enforceEx in @safe function.

import std.exception;
void test1() @safe
{
enforceEx!Exception(true, );
// Error: safe function 'test1' cannot call system function 'enforceEx'
}

This is dmd bug, using lazy parameter is inferred as unsafe, so whole enforceEx
calling is inferred as unsafe.

More simple test case.

T useLazy(T)(lazy T val)
{
return val;
}
void test2() @safe
{
useLazy(0);
// Error: safe function 'test2' cannot call system function 'useLazy'
}

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


[Issue 6690] Using lazy parameter should be inferred as @safe

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6690


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch
Summary|Using lazy parameter is |Using lazy parameter should
   |inferred as unsafe  |be inferred as @safe


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-09-18 15:31:19 PDT ---
https://github.com/D-Programming-Language/dmd/pull/391

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


[Issue 6689] Pure std.exception.bailOut()

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6689


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-09-18 15:37:39 PDT ---
https://github.com/D-Programming-Language/phobos/pull/263

I have already posted a pull request #263 to make enforce family @safe and
pure.

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


[Issue 6688] An struct that has @disable constructor does not work with template constraint

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6688



--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-09-18 16:11:34 PDT ---
This issue will be fixed by dmd/pull/286 as a side effect.
https://github.com/D-Programming-Language/dmd/pull/285

That patch applies STCparameter to function parameters correctly inside
template constraint, then errors are suppressed.

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


[Issue 6691] New: static constructor inside template cannot initialize immutable template members

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6691

   Summary: static constructor inside template cannot initialize
immutable template members
   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-09-18 18:43:52 PDT ---
Follwing should compile, but can't.

template Hoge()
{
immutable static int[int] dict;
immutable static int value;

static this()
{
dict = [1:1, 2:2];
value = 10;
}
}
alias Hoge!() H;

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


[Issue 6691] static constructor inside template cannot initialize immutable template members

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6691


Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||patch


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2011-09-18 19:24:31 PDT ---
https://github.com/D-Programming-Language/dmd/pull/392

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


[Issue 6473] Stack overflow with struct destructor as default parameter

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6473


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

   What|Removed |Added

 CC||clugd...@yahoo.com.au
Version|D1  D2 |D2
Summary|segfault in Lexer::uniqueId |Stack overflow with struct
   ||destructor as default
   ||parameter


--- Comment #1 from Don clugd...@yahoo.com.au 2011-09-19 02:10:40 PDT ---
It's not a segfault, and it has nothing to do with Lexer::uniqueId.
It's a stack overflow. It's also D2-only, because it requires a struct
destructor.

StructLiteralExp::semantic() sees that Eins has a destructor, so it rewrites it
as
Eins devices = (Eins tmp = Eins(), tmp);
Then, it runs semantic on the comma expression it created.
VarDeclaration::semantic on tmp calls StructLiteralExp::semantic, which again
sees Eins has destructor, so it does an another rewrite.
Eins devices = (Eins tmp = (Eins tmp2 = Eins(), tmp2), tmp);

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


[Issue 6692] New: std.math.sin function pointer

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6692

   Summary: std.math.sin function pointer
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-09-19 05:08:48 PDT ---
In some situations I'd like the std.math.sin and std.math.cos functions to be
more flexible and more *uniform* with all other user-written functions:


import std.math;
void main() {
auto a = [sin, cos];


Intrinsics have some advantages, but a uniform way to manage functions
(especially functions as common as sin/cos) is handy and allows some usages
that are not possible now (workaround: to do it I use small wrapper functions
for sin and cos).

Is it possible to have sin and cos functions usable like the other functions?

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


[Issue 6693] New: [CTFE] Cannot set value to nested AA

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6693

   Summary: [CTFE] Cannot set value to nested AA
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: youx...@gmail.com


--- Comment #0 from Hisayuki Mima youx...@gmail.com 2011-09-19 22:54:47 JST 
---
pragma(msg, {
int[int][int] aaa;
aaa[3][1] = 4;
return 0;
}());

This code doesn't be compiled by dmd v2.055.

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


[Issue 6692] std.math.sin function pointer

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6692


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||yebbl...@gmail.com
 Resolution||DUPLICATE


--- Comment #1 from yebblies yebbl...@gmail.com 2011-09-20 00:23:21 EST ---
*** This issue has been marked as a duplicate of issue 4541 ***

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


[Issue 4541] Intrinsic functions do not have pointers

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4541


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #2 from yebblies yebbl...@gmail.com 2011-09-20 00:23:21 EST ---
*** Issue 6692 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 6694] New: with statement doesn't work with functions that return structs

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6694

   Summary: with statement doesn't work with functions that return
structs
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-09-19 
09:14:03 PDT ---
struct Foo { }
Foo foo() { Foo _foo; return _foo; }

void main()
{
with (foo()) { }
}

Error: foo() is not an lvalue

For me this is particularly a problem when using property functions.

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


[Issue 6696] New: Error messages for const/immutable arrays given to immutable/const

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6696

   Summary: Error messages for const/immutable arrays given to
immutable/const
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-09-19 14:52:47 PDT ---
A wrong D2 program:

void foo(immutable ref int[5] a) {}
void bar(const ref int[5] a) {}
void main() {
const int[5] arr1;
foo(arr1); // line 5
immutable int[5] arr2;
bar(arr2); // line 7
}


DMD 2.055 prints:

test.d(5): Error: function test.foo (ref immutable immutable(int[5u]) a) is not
callable using argument types (const(int[5u]))
test.d(5): Error: cast(immutable(int[5u]))arr1 is not an lvalue
test.d(7): Error: cast(const(int[5u]))arr2 is not an lvalue

The first error message is almost good, but why does it print immutable
immutable?

I think the second error message is useless.

In line 7 the bar(arr2) call gives just a arr2 is not an lvalue that I think
is not good enough.


So for this program I think a better error message printout is something like:

test.d(5): Error: function test.foo(ref immutable(int[5]) a) is not callable
using argument types (const(int[5])).
test.d(7): Error: function test.foo(ref const(int[5]) a) is not callable using
argument types (immutable(int[5])).

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


[Issue 6695] New: immutable not inherited by members

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6695

   Summary: immutable not inherited by members
   Product: D
   Version: unspecified
  Platform: All
OS/Version: All
Status: NEW
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: luka8...@owave.net


--- Comment #0 from luka8088 luka8...@owave.net 2011-09-19 14:31:54 PDT ---
import std.stdio;

immutable struct a {
  b b1;
}

struct b {
  void c () immutable {
writeln(typeid(typeof(this))); // b instead of immutable(b)
  }
}
void main () {
  a a1;
  a1.b1.c();
}

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


[Issue 6697] New: std.bitmanip.FastBitMatrix

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6697

   Summary: std.bitmanip.FastBitMatrix
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
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-09-19 15:11:25 PDT ---
Created an attachment (id=1025)
First version of the bit matrix

I suggest to add a fast 2D matrix of bits to Phobos (probably in std_bitmanip):
- It is a common enough data structure, useful for simple implementations of
various games, cellular automata, 2D sets, and more.
- Despite being a simple data structure, it's not obvious, especially if you
want it to be fast. A naive implementation that uses a BitArray is not fast
enough.
- It doesn't need to be too much general. A 3D bit array is in my experience
quite less commonly useful, and the implementation is different enough.


In attach there is an efficient implementation, that I have used it for several
purposes. Some notes:
- It wastes a bit of RAM to be faster.
- I have named it FastBitMatrix because Fast helps remember this 2D matrix
wastes some memory to be as fast as possible.
- It uses two little commonly useful functions that in my opinion are better
moved in std.math.
- Currently it allocates memory with a normal dynamic array. With a small
change it's usable with smarter/faster allocators.
- There are ddocs and unittests for all the functions (but the unittests of
FastBitMatrix don't test its contracts).
- I have not tried it on 64 bit systems.
- Optional are a toString/writeTo method, a copy method, postblit, and other
constructors.
- Currently it's just a struct with value semantics.

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


[Issue 6697] std.bitmanip.FastBitMatrix

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6697



--- Comment #1 from bearophile_h...@eml.cc 2011-09-19 17:38:09 PDT ---
Created an attachment (id=1026)
Version 1.1 of the bit matrix

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


[Issue 6697] std.bitmanip.FastBitMatrix

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6697



--- Comment #2 from bearophile_h...@eml.cc 2011-09-19 17:43:27 PDT ---
Created an attachment (id=1027)
Version 1.2 of the bit matrix

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


[Issue 6694] with statement doesn't work with functions that return structs

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6694


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||yebbl...@gmail.com
 Resolution||DUPLICATE


--- Comment #1 from yebblies yebbl...@gmail.com 2011-09-20 11:02:33 EST ---
*** This issue has been marked as a duplicate of issue 6685 ***

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


[Issue 6685] Allow using with with rvalues

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6685


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com


--- Comment #1 from yebblies yebbl...@gmail.com 2011-09-20 11:02:33 EST ---
*** Issue 6694 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 6634] std.path.globMatch throws wrong assertion

2011-09-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=6634



--- Comment #2 from Rainer Schuetze r.sagita...@gmx.de 2011-09-19 22:53:22 
PDT ---
https://github.com/D-Programming-Language/phobos/pull/267

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