[Issue 5785] Lexing or Parsing issue with UFCS

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5785


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

   What|Removed |Added

   Keywords||patch


--- Comment #4 from Rainer Schuetze r.sagita...@gmx.de 2011-04-08 00:17:27 
PDT ---
Here is a patch that allows to deal with this without creating new tokens:

diff --git a/src/parse.c b/src/parse.c
index 162fa85..199cf89 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -5380,9 +5380,10 @@ Expression *Parser::parsePostExp(Expression *e)
 nextToken();
 if (token.value == TOKidentifier)
 {   Identifier *id = token.ident;
+enum TOK save;

 nextToken();
-if (token.value == TOKnot  peekNext() != TOKis)
+if (token.value == TOKnot  (save = peekNext()) != TOKis
 save != TOKin)
 {   // identifier!(template-argument-list)
 TemplateInstance *tempinst = new TemplateInstance(loc,
id);
 Objects *tiargs;

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


[Issue 5708] Incorrect string constant folding with -inline

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5708


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 CC||cbkbbej...@mailinator.com


--- Comment #8 from Nick Sabalausky cbkbbej...@mailinator.com 2011-04-08 
03:33:16 PDT ---
Don's still-in-progress CTFE overhaul seems to fix this:
https://github.com/donc/dmd/tree/ctfemem

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


[Issue 1827] Uniform syntax for is(), static if, alias, template definition static assert

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1827


Trass3r mrmoc...@gmx.de changed:

   What|Removed |Added

 CC||mrmoc...@gmx.de


--- Comment #6 from Trass3r mrmoc...@gmx.de 2011-04-08 06:20:17 PDT ---
(In reply to comment #1)
  --- I wonder if you ever try to define something like this:
  
  void parse(T : T == char[] || T == wchar[] || T == dchar[])(T str) {
   }
 
 You mean match a type if a Boolean condition is satisfied? Yes, I also felt a
 need for that.

Has this lead to template contraints?


  or wonder why symbol T gets redefined into array element like below:
   void parse(T : T[]) {}
 
 This is bar none the fugliest hack ever since eunuchs have been invented. I
 have argued many times with Walter to remove it, and probably de facto it will
 - none of the book's code samples will feature it.

Any updates?

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


[Issue 5818] New: 64bit ASM can't have 32-bit stack operands

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5818

   Summary: 64bit ASM can't have 32-bit stack operands
   Product: D
   Version: D1  D2
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: druntime
AssignedTo: nob...@puremagic.com
ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw ibuc...@ubuntu.com 2011-04-08 08:52:52 PDT ---
This is a question rolled into a report (it's affecting me, at least). This
excerpt (in core/thread.d for D2; in gc/gcx.d for D1 and D2) - the push EAX
instruction is not legal x86_64 asm code - according to the GNU 64bit
Assembler, which is strong enough an argument for me to follow - so is not
compilable with the GDC 64bit compiler (and maybe LDC too).

asm
{
push RAX ;
push RBX ;
push RCX ;
push RDX ;
push RSI ;
push RDI ;
push RBP ;
push R8  ;
push R9  ;
push R10  ;
push R11  ;
push R12  ;
push R13  ;
push R14  ;
push R15  ;
-- push EAX ;   // 16 byte align the stack-- This line causes the error
mov sp[RBP],RSP ;
}


So, what to do?

Well, first I think druntime should consider revising this code for a start.
And secondly, DMD should be hardened to catch and disallow this.


Some thoughts for how to change it:

In 32bit mode:
pusha (afaik) saves (e)ax, cx, dx, bx, sp, bp, si, di
popa restores (e)di, si, bp, bx, dx, cx, ax  (note, stack is not popped)

In GCC builtins:
unwind_init (what is currently being used in place of the above illegal code in
GDC) saves only the rbx, r12, r13, r14 and r15 registers.

Regards

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


[Issue 5818] 64bit ASM can't have 32-bit stack operands

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5818


Iain Buclaw ibuc...@ubuntu.com changed:

   What|Removed |Added

 CC||ibuc...@ubuntu.com


--- Comment #1 from Iain Buclaw ibuc...@ubuntu.com 2011-04-08 09:11:16 PDT ---
Infact, examining an object jump output DMD emits a push to RAX, not EAX - so
this is just dumb.

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


[Issue 5819] New: DMD doesn't error/warn about illegal asm for 64bit mode

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5819

   Summary: DMD doesn't error/warn about illegal asm for 64bit
mode
   Product: D
   Version: D1  D2
  Platform: x86_64
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: ibuc...@ubuntu.com


--- Comment #0 from Iain Buclaw ibuc...@ubuntu.com 2011-04-08 09:27:35 PDT ---
64bit DMD will happily compile this and emit a bad executable.

void main()
{
// All the following should be illegal for x86-64
asm {
aaa;// illegal
aad;// illegal
aam;// illegal
aas;// illegal
daa;// illegal
das;// illegal
into;   // illegal
pop DS; // illegal
pop ES; // illegal
pop SS; // illegal
popa;   // illegal
push CS;// illegal
push DS;// illegal
push ES;// illegal
push SS;// illegal
pusha;  // illegal
pushf;  // illegal
popf;   // illegal


// Miscellaneous issue: 
// DMD silently replaces EAX with RAX, etc, etc.
// Should really be an error.
pop EAX;// can't have 32-bit stack operands in 64bit mode
push EAX;   // can't have 32-bit stack operands in 64bit mode
}
}


Regards

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


[Issue 4140] Error: non-constant expression hello[1u..__dollar]

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4140


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

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #2 from Walter Bright bugzi...@digitalmars.com 2011-04-08 
09:59:09 PDT ---
https://github.com/D-Programming-Language/dmd/commit/194bac06181bab3ec9b937615f850fbfe28a58a8

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


Stable sort in std.algorithm throws Range violation

2011-04-08 Thread Matthias Walter
Hi,

when using the most recent D2/32bit version from github of
dmd+druntime+phobos I get a Range violation from the following code:

| import std.algorithm;
|
| void main(char[][] args)
| {
|   sort!(a  b, SwapStrategy.stable)([1,0, 3, 2]);
| }

Can anybody confirm this? Shall I file a bug?

best regards,

Matthias Walter


[Issue 5820] New: Documentation states string literals can implicitly convert to char*

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5820

   Summary: Documentation states string literals can implicitly
convert to char*
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: trivial
  Priority: P2
 Component: websites
AssignedTo: nob...@puremagic.com
ReportedBy: simen.end...@pandavre.com


--- Comment #0 from simendsjo simen.end...@pandavre.com 2011-04-08 10:30:54 
PDT ---
http://digitalmars.com/d/2.0/arrays.html says
(...), and a string literal can be implicitly cast to a char*

char* a = a; // cannot implicitly convert expression a of type string to
char*
char* b = cast(char*)a; // ok
const(char)* c = a; // ok

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


[Issue 5821] New: Calling spawn in std.concurrency without all the parameters required by void function(T) fn

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5821

   Summary: Calling spawn in std.concurrency without all the
parameters required by void function(T) fn
   Product: D
   Version: D2
  Platform: x86
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: jsan...@gmail.com


--- Comment #0 from Jose Garcia jsan...@gmail.com 2011-04-08 13:33:50 PDT ---
I am not sure if this a language, compiler, or library issue but when you call
spawn without passing all the parameters required by the fn it can either
segfault if you are lucky or worst yet have an unpredictable behavior.

For example the following code will compile and execute:

import std.concurrency;

void main()
{
   spawn(fun);
}

void fun(int i) {}

My intuition is that the code above should not compile.

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


[Issue 5822] New: Segfault when adding File to an Associative array

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5822

   Summary: Segfault when adding File to an Associative array
   Product: D
   Version: D2
  Platform: Other
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: jsan...@gmail.com


--- Comment #0 from Jose Garcia jsan...@gmail.com 2011-04-08 13:55:15 PDT ---
The following calls segfault at the point when File is added to the associative
array 'moreFiles'.

import std.stdio;

unittest
{
  auto file = File(deleteme, w);
  File[] files = new File[0];
  files ~= file;
  assert(files.length == 1);
  File[int] moreFiles;
  moreFiles[1] = File(deletemetoo, w);
}

void main() {}

Stack trace:

$ dmd file_bug.d -unittest  ./file_bug
./file_bug(_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv+0x2c)[0x809a68c]
[0x4ba40c]
./file_bug(_D3std5stdio4File8opAssignMFS3std5stdio4FileZv+0x17)[0x8098077]
./file_bug(_D8file_bug11__unittest1FZv+0xca)[0x809441e]
./file_bug(_D8file_bug9__modtestFZv+0x8)[0x809444c]
./file_bug(_D4core7runtime18runModuleUnitTestsUZb16__foreachbody247MFKPS6object10ModuleInfoZi+0x24)[0x809a6ec]
./file_bug(_D6object10ModuleInfo7opApplyFMDFKPS6object10ModuleInfoZiZi+0x46)[0x8096522]
./file_bug(runModuleUnitTests+0x87)[0x809a607]
./file_bug(_D2rt6dmain24mainUiPPaZi6runAllMFZv+0x20)[0x8096f48]
./file_bug(_D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv+0x20)[0x8096ea8]
./file_bug(main+0x94)[0x8096e54]
/lib/libc.so.6(__libc_start_main+0xe7)[0xc3ace7]
./file_bug[0x80942a1]
Segmentation fault

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


[Issue 5823] New: @property call syntax restriction not implemented

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5823

   Summary: @property call syntax restriction not implemented
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: michel.for...@michelf.com


--- Comment #0 from Michel Fortin michel.for...@michelf.com 2011-04-08 
18:02:26 EDT ---
(Initially posted on the phobos mailing list:
http://lists.puremagic.com/pipermail/phobos/2011-April/004768.html)

I made an experiment last month: I changed an #if 0 to #if 1 in the
compiler source, one that was meant to enable proper enforcement of the
property syntax. Then I went on an fixed a things everywhere to make everything
compile and work.

It turned out to be a colossal task to fix everything that needed fixing (a few
things DMD but most problems coming from Phobos and Druntime), and after doing
a lot of it I started working on other things and left the project untouched
since then.

I'd have preferred to present something finished, but given that I'm not sure
when I'll work on it again I though it might be a good idea to let someone else
take over (if someone wants to). Even if no one works on it, it might be
interesting as a way to see how many things have been relying on the
non-enforcement of @property. You can look at the @property branch in my dmd,
druntime and Phobos forks on github to see what was affected by this change:

DMD:
https://github.com/michelf/dmd/commits/%40property

Druntime:
https://github.com/michelf/druntime/commits/%40property

Phobos:
https://github.com/michelf/phobos/commits/%40property

Status: Druntime changes should be complete, Phobos is incomplete and I think I
was stuck on a compiler bug triggered by this change when I stopped working on
it last month, so there might be still a few things to fix in the compiler.

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


[Issue 1330] Array slicing does not work the same way in CTFE as at runtime

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1330


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #3 from Don clugd...@yahoo.com.au 2011-04-08 21:16:15 PDT ---
Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 3801] CTFE: this.arr[i] cannot be evaluated at compile time for structs

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3801


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #5 from Don clugd...@yahoo.com.au 2011-04-08 21:16:50 PDT ---
Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 3835] ref foreach does not work in CTFE

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3835


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #13 from Don clugd...@yahoo.com.au 2011-04-08 21:17:18 PDT ---
Fixed.

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 4050] [CTFE] array struct member slice update

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4050


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from Don clugd...@yahoo.com.au 2011-04-08 21:17:57 PDT ---
Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 4051] [CTFE] array struct member item update

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4051


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #1 from Don clugd...@yahoo.com.au 2011-04-08 21:18:20 PDT ---
Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 5147] [CTFE] Return fixed-sized matrix

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5147


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED
   Severity|enhancement |normal


--- Comment #3 from Don clugd...@yahoo.com.au 2011-04-08 21:20:10 PDT ---
This is definitely a bug, not an enhancement. It applies to any use of
multidimensional static arrays in CTFE (not just return values). Thus, it also
applies to D1.

Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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


[Issue 5708] Incorrect string constant folding with -inline

2011-04-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5708


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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


--- Comment #9 from Don clugd...@yahoo.com.au 2011-04-08 21:22:35 PDT ---
(In reply to comment #8)
 Don's still-in-progress CTFE overhaul seems to fix this:
 https://github.com/donc/dmd/tree/ctfemem

Yes, it fixes almost all CTFE bugs involving arrays.

Fixed.
D1:
https://github.com/D-Programming-Language/dmd/commit/ef2a0f1da10331c4de102ca3e029ea1c1c1a46bf

D2:
https://github.com/D-Programming-Language/dmd/commit/0219a5f0dcc88076759a4c472582954d0fb804b0

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