[Issue 3372] New: optlink silently mistreats object files with more than 16384 symbols

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

   Summary: optlink silently mistreats object files with more than
16384 symbols
   Product: D
   Version: 2.033
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: major
  Priority: P2
 Component: Optlink
AssignedTo: nob...@puremagic.com
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2009-10-07 23:50:29 
PDT ---
Larger projects (like qtd) are suffering from problems with large object files
with a lot of symbols, where the linker creates bad fixups, creating
executables that are calling wrong functions.

Here's a test case that creates a lot of symbols

//

import std.stdio;

class genfuns(int n, int m)
{
static void run() { 
genfuns!(n - 1, m).run(); 
}
}

class genfuns(int n : 0, int m)
{
static void run() { writefln(=== 0, %d ===, m); }
}

void main()
{
// dmd-release: stack overflow with n=700
// dmd-debug:   stack overflow with n=500
genfuns!(300, 0).run(); 
genfuns!(300, 1).run();
genfuns!(300, 2).run();
genfuns!(300, 3).run();
genfuns!(300, 4).run();
genfuns!(300, 5).run();
genfuns!(300, 6).run();
genfuns!(300, 7).run();
genfuns!(300, 8).run();
genfuns!(300, 9).run();
genfuns!(300, 10).run();
genfuns!(300, 11).run();
}


The output looks like this:

=== 0, 0 ===
=== 0, 1 ===
=== 0, 2 ===
=== 0, 3 ===
=== 0, 4 ===
=== 0, 5 ===
=== 0, 6 ===
=== 0, 7 ===
=== 0, 8 ===
=== 0, 9 ===
=== 0, 0 ===
=== 0, 0 ===

That shows, that the two last functions are calling wrong functions. The
symbols don't even show up in the map file, but are still in the debug info.
There you can see, that the adress is plain wrong, and searching the symbol in
the object file dump, it seems that symbol #16384 + n gets the address of
symbol #n.

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


[Issue 1140] ICE(cod1.c) casting last function parameter to 8 byte value

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


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

   What|Removed |Added

   Keywords||patch


--- Comment #5 from Don clugd...@yahoo.com.au 2009-10-07 23:58:13 PDT ---
This seems to be a superficial ICE. It only happens in this wierd situation, 
when a parameter, which was passed in a register, needs to be stored into a 
double-register (EDX:EAX).
In this case, the existing register can't be re-used, even though it satisfies 
all the conditions in cod1 line 3433.
We simply need to add an extra condition to prevent the register being 
re-used.After this simple change, correct code is generated instead of the ICE. 
I think this case never occurs in the calling conventions used in DMC.

 Of course, taking the address of an parameter, then casting it to the wrong 
size is a highly dubious thing
 to be doing, since it's getting whatever happens to be on the stack. Unsafe 
mode only!

 PATCH (against DMD2.033) cod1.c, line 3434:

// See if we can use register that parameter was passed in
if (regcon.params  e-EV.sp.Vsym-Sclass == SCfastpar 
-regcon.params  mask[e-EV.sp.Vsym-Spreg])
+regcon.params  mask[e-EV.sp.Vsym-Spreg]  sz!=REGSIZE*2)
{assert(sz = REGSIZE);
reg = e-EV.sp.Vsym-Spreg;
forregs = mask[reg];
mfuncreg = ~forregs;
regcon.used |= forregs;
return fixresult(e,forregs,pretregs);
}

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


[Issue 3373] New: bad codeview debug info for long and ulong

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

   Summary: bad codeview debug info for long and ulong
   Product: D
   Version: 2.033
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: r.sagita...@gmx.de


--- Comment #0 from Rainer Schuetze r.sagita...@gmx.de 2009-10-07 23:58:40 
PDT ---
The codeview debug info emitted by dmd for long and ulong types are a bad
delegate and dynamic-array of ints, respectively.

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


[Issue 3373] bad codeview debug info for long and ulong

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


Rainer Schuetze r.sagita...@gmx.de changed:

   What|Removed |Added

   Keywords||patch, wrong-code


--- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2009-10-08 00:01:22 
PDT ---
This is caused a bad check in cv4_typeidx() that will never use the basic
types, because cv4_typidx(t-Tnext) never returns 0. Instead, t-Tnext should
be tested:

Index: cgcv.c
===
--- cgcv.c(revision 201)
+++ cgcv.c(working copy)
@@ -1677,14 +1677,14 @@
 switch (tym)
 {
 case TYllong:
-if (next)
+if (t-Tnext)
 goto Ldelegate;
 assert(dt);
 typidx = dt;
 break;

 case TYullong:
-if (next)
+if (t-Tnext)
 goto Ldarray;
 assert(dt);
 typidx = dt;

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


[Issue 3119] Segfault combining std.c.linux and passing a ref string

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


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

   What|Removed |Added

   Keywords||ice-on-valid-code
 CC||clugd...@yahoo.com.au


--- Comment #1 from Don clugd...@yahoo.com.au 2009-10-08 05:09:51 PDT ---
Can someone please (1) check that this fails; and
(2) reduce the test case?

Need to work out which part of std.c.linux.linux is triggering it. Probably
isn't Linux specific, unless it's crashing in the code generation step.

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


[Issue 3375] New: Ternary operator doesn't yield an lvalue

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

   Summary: Ternary operator doesn't yield an lvalue
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
11:20:15 PDT ---
Consider:

int x, y;
(true ? x : y) += 5;

This code fails with:

Error: conditional expression true ? x : y is not a modifiable lvalue

When both branches in a ternary expression are lvalues of the same type, the
result must be an lvalue.

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


[Issue 3376] New: [tdpl] Multiple ranged case labels don't work

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

   Summary: [tdpl] Multiple ranged case labels don't work
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
12:00:23 PDT ---
void classify(char c) {
   write(You passed );
   switch (c) {
  case '#': 
 writeln(a hash sign.); 
 break;
  case '0': .. case '9': 
 writeln(a digit.); 
 break;
  case 'A': .. case 'Z': case 'a' .. case 'z': 
 writeln(an ASCII character.); 
 break;
  case '.', ',', ':', ';', '!', '?': 
 writeln(a punctuation mark.); 
 break;
  default:
 writeln(quite a character!);
 break;
   }
}

The code fails to compile. If I change the line:

  case 'A': .. case 'Z': case 'a' .. case 'z': 

to:

  case 'A': .. case 'Z':

then it compiles.

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


[Issue 3377] New: [tdpl] static foreach should be implemented

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

   Summary: [tdpl] static foreach should be implemented
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
12:12:29 PDT ---
This should compile:

import std.contracts;

double unrolledDotProduct(double[] a, double[] b) {
   enum branches = 4;
   enforce(a.length == b.length);
   double result = 0;
   auto n = (a.length / branches) * branches;
   double temp[branches];
   for (size_t i = 0; i != n; i += branches) {
  static foreach (j ; 0 .. branches) {
 temp[j] = a[i + j] * b[i + j];
  }
  result += inline_sum(temp);
   }
   foreach (j; n .. a.length) {
  result += a[j] * b[j];
   }
   return result;
}

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


[Issue 3377] [tdpl] static foreach should be implemented

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


downs default_357-l...@yahoo.de changed:

   What|Removed |Added

 CC||default_357-l...@yahoo.de


--- Comment #1 from downs default_357-l...@yahoo.de 2009-10-08 12:35:53 PDT 
---
This does compile (on 1.0):

template Repeat(T, int I) {
  static if (!I) alias Tuple!() Repeat;
  else alias Tuple!(T, Repeat!(T, I - 1)) Repeat;
}

double unrolledDotProduct(double[] a, double[] b) {
   const branches = 4;
   assert(a.length == b.length);
   double result = 0;
   auto n = (a.length / branches) * branches;
   double temp[branches];
   for (size_t i = 0; i != n; i += branches) {
  foreach (j, BOGUS; Repeat!(void, branches)) {
 temp[j] = a[i + j] * b[i + j];
  }
  result += inline_sum(temp);
   }
   foreach (j; n .. a.length) {
  result += a[j] * b[j];
   }
   return result;
}

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


[Issue 3378] New: [tdpl] ++x should be an lvalue

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

   Summary: [tdpl] ++x should be an lvalue
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
14:12:33 PDT ---
This doesn't compile:

ref int bump(ref int x) { return ++x; }

The error message reveals two other issues:

Error: x += 1 is not an lvalue

1. The increment is rewritten as x += 1, but it shouldn't as it's a
fundamentally different operation

2. x += 1 is not a value itself. Indeed this doesn't compile either:

ref int bump(ref int x) { return x += 1; }

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


[Issue 3379] New: [tdpl] Parameter names not visible in the if clause of a template

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

   Summary: [tdpl] Parameter names not visible in the if clause of
a template
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
14:25:57 PDT ---
This code does not compile:

T1[] find(T1, T2)(T1[] longer, T2[] shorter)
   if (is(typeof(longer[0 .. 1] == shorter) : bool))
{
   while (longer.length = shorter.length) {
  if (longer[0 .. shorter.length] == shorter) break;
  longer = longer[1 .. $];
   }
   return longer;
}

unittest {
   double[] d1 = [ 6.0, 1.5, 2.4, 3 ];
   double[] d2 = [ 1.5, 2.4 ];
   assert(find(d1, d2) == d1[1 .. $]);
}

(I believe I'd submitted this bug already. Please don't mark as duplicate so
all TDPL-related errors stay together.)

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


Re: [Issue 3377] [tdpl] static foreach should be implemented

2009-10-08 Thread Christopher Wright

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

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


downs default_357-l...@yahoo.de changed:

   What|Removed |Added

 CC||default_357-l...@yahoo.de


--- Comment #1 from downs default_357-l...@yahoo.de 2009-10-08 12:35:53 PDT 
---
This does compile (on 1.0):

template Repeat(T, int I) {
  static if (!I) alias Tuple!() Repeat;
  else alias Tuple!(T, Repeat!(T, I - 1)) Repeat;
}


downs, you are a genius. You can create code that is both elegant and 
dreadful. You make the world a more interesting place.


[Issue 3380] New: [tdpl] typeid(obj) should return the dynamic type of the object

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

   Summary: [tdpl] typeid(obj) should return the dynamic type of
the object
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
19:31:52 PDT ---
class A {}
class B : A {}

void main() {
   auto a = new A;
   writeln(typeid(a));
}

Currently typeid only applies to a type and consequently returns static type
information. This bug report aims at merging classinfo into TypeInfo_class. We
need to therefore have typeid accept values.

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


[Issue 3381] New: [tdpl] Incorrect assessment of overriding in triangular-shaped hierarchy

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

   Summary: [tdpl] Incorrect assessment of overriding in
triangular-shaped hierarchy
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


--- Comment #0 from Andrei Alexandrescu and...@metalanguage.com 2009-10-08 
20:36:16 PDT ---
This code doesn't compile:

interface VisualElement {
   void draw();
}

interface Actor {
}

interface VisualActor : Actor, VisualElement {
}

class Sprite3 : Actor, VisualActor {
override void draw() { }
}

The error message is:

Error: function test.Sprite3.draw does not override any function

If I comment out the implementation of draw I get:

Error: class test.Sprite3 interface function VisualElement.draw isn't
implemented

Of course, both of these can't be true at the same time :o). The original
program should compile and run properly.

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