[Issue 4240] New: Array operations on short fixed-length arrays should be inlined

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4240

   Summary: Array operations on short fixed-length arrays should
be inlined
   Product: D
   Version: 1.020
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: performance
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-05-26 23:19:03 PDT ---
If an array operation is performed on a short fixed-length array, for example:

float[3] x,y;
x[] += y[] * 4.0;

then it should not become a function call, it should simply be turned into:

x[0] += y[0] * 4.0;
x[1] += y[1] * 4.0;
x[2] += y[2] * 4.0;

I suspect that the threshold for making the function call will be occur at
length at least 9, possibly higher, since the overhead for the function call is
very large (it needs to check the capabilities of the processor, for example).

This will allow array operations to provide good performance in the
commonly-used case of 2D, 3D and 4D vectors.

For x86, when the code generator supports it, such usage should be turned
directly into SSE instructions. This issue is a step towards that longer-term
goal.

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


[Issue 2879] std.bigint missing from phobos

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2879


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@kyllingen.net
 Resolution||FIXED


--- Comment #2 from Lars T. Kyllingstad bugzi...@kyllingen.net 2010-05-26 
23:43:08 PDT ---
New std.bigint documentation available since DMD 2.043.

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


[Issue 4241] New: duplicate union initialization error doesn't give a file location

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4241

   Summary: duplicate union initialization error doesn't give a
file location
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: mrmoc...@gmx.de


--- Comment #0 from Trass3r mrmoc...@gmx.de 2010-05-27 10:48:54 PDT ---
import std.typetuple;

/// repeat a type count times
template Repeat(T, int count)
{
static if (!count)
alias TypeTuple!() Repeat;
else
alias TypeTuple!(T, Repeat!(T, count-1)) Repeat;
}

struct Vector(T, int dim)
{
static assert (dim = 2  dim = 4);

union
{
// including these gives more errors of the same kind
//T[dim] cell;/// array access
//Repeat!(T, dim) tuple;/// for tuple access

/// normal struct element access
struct
{
static if (dim = 1)union { T x; T r; }
static if (dim = 2)union { T y; T g; }
static if (dim = 3)union { T z; T b; }
static if (dim = 4)union { T w; T a; }
}
}

// these constructors are workarounds for the overlapping initialization
for _tuple_field_0 problem
static if (dim == 2)
this(T ax, T ay)
{
x = ax;
y = ay;
}

static if (dim == 3)
this(T ax, T ay, T az)
{
x = ax;
y = ay;
z = az;
}

static if (dim == 4)
this(T ax, T ay, T az, T aw)
{
x = ax;
y = ay;
z = az;
w = aw;
}

static if (2 == dim) const static Vector zero = Vector(0, 0);
static if (3 == dim) const static Vector zero = Vector(0, 0, 0);
static if (4 == dim) const static Vector zero = Vector(0, 0, 0, 0);
}

alias Vector!(float, 2)Vector2f; ///
alias Vector!(float, 3)Vector3f; ///
alias Vector!(float, 4)Vector4f; ///

yields:
Error: duplicate union initialization for r
Error: duplicate union initialization for g
Error: duplicate union initialization for r
Error: duplicate union initialization for g
Error: duplicate union initialization for b
Error: duplicate union initialization for r
Error: duplicate union initialization for g
Error: duplicate union initialization for b
Error: duplicate union initialization for a


It would be helpful to have a file location.
Unfortunately for some reason loc is null in StructLiteralExp::toDt(dt_t **pdt)
where the error occurs.

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


[Issue 4242] New: ICE(module.c): module naming conflict in subfolder

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4242

   Summary: ICE(module.c): module naming conflict in subfolder
   Product: D
   Version: 2.041
  Platform: Other
OS/Version: Windows
Status: NEW
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2010-05-27 15:06:39 PDT ---
Reported by Matthias.
-
The dmd compiler v2.046 produces correct output (Error: module test from file
xxx.d conflicts with another module test from file yyy.d), if multiple
placement of same module identifier are in the root of the project, however it
crashes, when the files are in a subfolder and does not display a proper error
message.

The output is:
Assertion failure: 'mprev' on line 641 in file 'module.c'

Test case:
--main.d--
import std.stdio;

import folder.File1;
import folder.File2;

int main(char[][] args)
{
writefln(file2);
return 0;
}

--folder\File1.d--
module folder;

const char[] file1 = File1;

--folder\File2.d--
module folder;

const char[] file2 = File2;

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


[Issue 4243] New: [snn.lib] setmode doesn't set stdin/stdout to binary

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4243

   Summary: [snn.lib] setmode doesn't set stdin/stdout to binary
   Product: D
   Version: 2.041
  Platform: x86
   URL: http://www.digitalmars.com/d/archives/digitalmars/D/se
tmode_again_74658.html
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: rsi...@gmail.com


--- Comment #0 from Shin Fujishiro rsi...@gmail.com 2010-05-27 15:32:13 PDT 
---
setmode(stdout, O_BINARY) does not set stdout to binary mode.  setmode surely
works for fopen'ed files, but does not work for standard file streams.

 test1.d
import std.c.stdio;
extern(C) int setmode(int, int);
enum O_BINARY = 0x8000;
void main()
{
string s = \n;

// write to stdout
setmode(stdout._file, O_BINARY);// set to binary mode
fwrite(s.ptr, 1, s.length, stdout);

// write to test.dat
auto f = fopen(test.dat, w);// open in text mode
setmode(f._file, O_BINARY); // set to binary mode
fwrite(s.ptr, 1, s.length, f);
fclose(f);
}

dmd -run test1 | od -c
000\r  \n   -- written in text mode
002
od -c test.dat
000\n   -- okay
001


This also does not work:
 test2.d
import std.c.stdio;
enum _IOTRAN = 0x100; // taken from DMC include/stdio.h
void main()
{
string s = \n;
stdout._flag = ~_IOTRAN;
fwrite(s.ptr, 1, s.length, stdout);
}

dmd -run test2 | od -c
000\r  \n   -- written in text mode
002


Only this works:
 test3.d
import std.c.stdio;
void main()
{
string s = \n;
__fhnd_info[stdout._file] = ~FHND_TEXT;
fwrite(s.ptr, 1, s.length, stdout);
}

dmd -run test3 | od -c
000\n   -- okay, written in binary mode
001


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


[Issue 4244] New: AA insert from fixed-sized array much slower than from equivalent struct

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4244

   Summary: AA insert from fixed-sized array much slower than from
equivalent struct
   Product: D
   Version: future
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: performance
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-05-27 17:08:06 PDT ---
This D2 program gets much slower if foo1() is used inside the main() instead of
foo2() that apparently does something very similar (compiled with dmd v2.046,
__gshared not used, compilation arguments -O -release -inline):


import std.c.stdio: printf;

int foo1(int x, int y) {
static int[int[2]] cache;
int[2] args = [x, y];
cache[args] = x;
return x;
}

int foo2(int x, int y) {
static struct Pair { int x, y; }
static int[Pair] cache;
Pair args = Pair(x, y);
cache[args] = x;
return x;
}

void main() {
enum int N = 600;
int tot;
foreach (x; 1 .. N)
foreach (y; 1 .. N)
tot += foo1(x, y);
printf(%d\n, tot);
}



An experiment shows that foo1 gets quite faster if the [x,y] is written inside
the cache AA itself:

int foo1(int x, int y) {
static int[int[2]] cache;
int[2] args = [x, y];
cache[[x, y]] = x;
return x;
}

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


[Issue 4235] !in not working (D1)

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4235


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

   Keywords||ice-on-valid-code,
   ||rejects-valid
URL||http://www.digitalmars.com/
   ||d/1.0/expression.html
 CC||s...@iname.com


--- Comment #2 from Stewart Gordon s...@iname.com 2010-05-27 18:56:52 PDT ---
The spec is a more authoritative source than the changelog.

But still, changelogs should be complete.  A particular problem occurs if
something's noted in the changelog, but then later it is reverted without being
noted in the changelog.  See issue 926 for an example.

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


[Issue 4227] Overloading rules not complete in D1 docs

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4227


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

   Keywords||spec
 CC||s...@iname.com


--- Comment #1 from Stewart Gordon s...@iname.com 2010-05-27 19:00:03 PDT ---
If I'd like to overload what functions?

Some sample code to explain what you're on about would help.

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


[Issue 4206] type accepted as enum initializer

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4206


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

 CC||s...@iname.com


--- Comment #1 from Stewart Gordon s...@iname.com 2010-05-27 19:36:23 PDT ---
Strange that you're getting this in 1.056 - I've always understood enums
without {} to be a D2-specific feature.  I certainly can't reproduce under
1.061.

But under 2.046:

--
alias int myint;
enum var = myint;

pragma(msg, var);
pragma(msg, typeof(var));
--
int
bz4206.d(5): Error: argument int to typeof is not an expression
void
--

This should error at line 2 - myint is a type, not a value.

But I wonder if it's by any chance related to issue 2414.

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


[Issue 3909] toDelegate handles only a tiny subset of function pointer types

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3909


Shin Fujishiro rsi...@gmail.com changed:

   What|Removed |Added

 AssignedTo|rsi...@gmail.com|nob...@puremagic.com


--- Comment #4 from Shin Fujishiro rsi...@gmail.com 2010-05-27 22:12:09 PDT 
---
I commited a hacky workaround in svn r1561.  Now it works with user-defined
types and function attributes (such as pure).  But I leave this bug opened
becuase the bug is not completely fixed.

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


[Issue 4242] ICE(module.c): importing a module with same name as package

2010-05-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4242


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

   What|Removed |Added

   Keywords||patch
Summary|ICE(module.c): module   |ICE(module.c): importing a
   |naming conflict in  |module with same name as
   |subfolder   |package
   Severity|normal  |regression


--- Comment #1 from Don clugd...@yahoo.com.au 2010-05-27 22:53:49 PDT ---
This is a regression since DMD2.043. Only a single import is required (don't
need File2 in the test case).

PATCH:

Index: module.c
===
--- module.c(revision 502)
+++ module.c(working copy)
@@ -638,9 +638,16 @@
 Dsymbol *prev = dst-lookup(ident);
 assert(prev);
 Module *mprev = prev-isModule();
-assert(mprev);
-error(loc, from file %s conflicts with another module %s from file
%s,
-srcname, mprev-toChars(), mprev-srcfile-toChars());
+if (mprev)
+error(loc, from file %s conflicts with another module %s from
file %s,
+srcname, mprev-toChars(), mprev-srcfile-toChars());
+else
+{
+Package *pkg = prev-isPackage();
+assert(pkg);
+error(loc, from file %s conflicts with package name %s ,
+srcname, pkg-toChars());
+}
 }
 else
 {

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