[Issue 9760] PIC code uses variable and thus needs a stack frame

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9760



--- Comment #2 from Martin Nowak c...@dawg.eu 2013-03-19 23:17:05 PDT ---
The GOT loading code sequence doesn't work because I have no detailed control
about the emitted relocations. This uses a R_386_GOT32 relocation instead of
the needed R_386_GOTPC one.


extern(C) __gshared extern void* _GLOBAL_OFFSET_TABLE_;

void loadGOT()
{
asm
{
naked;
call Lgot;
Lgot: pop EBX;
add EBX, offsetof _GLOBAL_OFFSET_TABLE_ + 3;
}
}


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


[Issue 9758] Ddoc: empty ddoc comment and unittest block generates no Examples section

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9758


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


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


[Issue 9764] New: Ddoc: Ddoc file name is incorrectly emphasized

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9764

   Summary: Ddoc: Ddoc file name is incorrectly emphasized
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Keywords: ddoc
  Severity: regression
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara k.hara...@gmail.com 2013-03-19 23:41:57 PDT ---
In http://dlang.org/attribute :

attribute declaration; // affects the declaration

attribute: // affects all declarations until the end of
   // the current scope
  declaration;
  declaration;
  ...

attribute {// affects all declarations in the block
  declaration;
  declaration;
  ...
}

attribute word is incorrectly underlined.

Test case:
test.dd

Ddoc

Check test document.

// Check test comment.
test();- test is underlined


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


[Issue 9760] PIC code uses variable and thus needs a stack frame

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9760



--- Comment #3 from Walter Bright bugzi...@digitalmars.com 2013-03-19 
23:46:44 PDT ---
The inline assembler doesn't give access to the complete set of relocation
types. For those, it's best not to use naked and let the compiler set it up for
you.

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


[Issue 9764] Ddoc: Ddoc file name is incorrectly emphasized

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9764


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

   What|Removed |Added

   Keywords||pull


--- Comment #1 from Kenji Hara k.hara...@gmail.com 2013-03-20 01:01:34 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1775

This regression is introduced by bug 9369, in 2.062.

https://github.com/D-Programming-Language/dmd/commit/2471fe912b0707e30be3c7b58d5a0f70a0f6a796

https://github.com/D-Programming-Language/dmd/commit/9f780b01c551ff86b6cb9b9acd152dce158a7419

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


[Issue 9765] New: Error message with __error with struct literal dotvar expression

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9765

   Summary: Error message with __error with struct literal dotvar
expression
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: minor
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don clugd...@yahoo.com.au 2013-03-20 02:09:45 PDT ---
struct S9765 { char[] x; }
const S9765 s9765 = S9765('x');
const char s9765b = s9765.x;

jj.d(3): Error: cannot implicitly convert expression ('x') of type char to
char[]
jj.d(4): Error: cannot implicitly convert expression ((__error).x) of type
const(char[]) to const(char)

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


[Issue 9760] asm docs should say PIC code uses variable and thus needs a stack frame

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9760


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

   What|Removed |Added

   Keywords||spec
 Status|RESOLVED|REOPENED
 Resolution|INVALID |
Summary|PIC code uses variable and  |asm docs should say PIC
   |thus needs a stack frame|code uses variable and thus
   ||needs a stack frame


--- Comment #4 from Don clugd...@yahoo.com.au 2013-03-20 04:40:43 PDT ---
Reopening this as a spec bug. I think the docs for 'naked' should mention this,
since it's not at all obvious that any variables are being used in the example
code.

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


[Issue 7176] Lambda = syntax for function and methods too

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7176



--- Comment #15 from bearophile_h...@eml.cc 2013-03-20 06:13:22 PDT ---
After having used Scala a little, I now have changed my mind a little again.

In Scala you write:

def f3(x: Int, y: Int): Int = if (x == 0) x else x * y


This is current valid D code:

int f1(int x, int y) { return (x == 0) ? x : x ^^ 2; }

const f2 = (int x, int y) = (x == 0) ? x : x ^^ 2;



Allowing this in D is nice to reduce some syntax noise. So I now like this
idea:

int f4(int x, int y) = (x == 0) ? x : x ^^ 2;


In functional-style programming very short functions are common.

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


[Issue 4705] Redesign of std.algorithm.max()/min() + mins()/maxs()

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4705



--- Comment #15 from bearophile_h...@eml.cc 2013-03-20 06:16:14 PDT ---
In Haskell the reduce!min and reduce!max are named minimum and maximum.

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


[Issue 7176] Lambda = syntax for function and methods too

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7176


Nick Treleaven ntrel-pub...@yahoo.co.uk changed:

   What|Removed |Added

 CC||ntrel-pub...@yahoo.co.uk


--- Comment #16 from Nick Treleaven ntrel-pub...@yahoo.co.uk 2013-03-20 
07:15:30 PDT ---
(In reply to comment #7)
 I could really have a use for this. I have a lot of methods that just returns 
 a
 single expression.

I thought I'd add some hard data on this. There are quite a lot of these in
Phobos (edited results to only show larger count items):

$ git grep -Ec '\{\s*return\b' std/
std/algorithm.d:77
std/cpuid.d:27
std/format.d:35
std/functional.d:37
std/math.d:31
std/range.d:86
std/regex.d:44
std/traits.d:71
std/typecons.d:54
std/variant.d:23
std/xml.d:24

Admittedly, some of these may be false positives for e.g. lambdas, but a quick
scan through the results shows they are almost all one line function/method
definitions. I think this demonstrates a significant use case for the proposed
syntax.

 Another idea would be to allow optional braces for methods and functions, just
 as for if-statements.

That might not be ideal syntax with template constraints:
void foo(T)(T v) if (isFoo!T) writeln(v);
void foo(T)(T v) if (isFoo!T) = writeln(v);

The second syntax is clearer in distinguishing the constraint from if statement
syntax IMO.

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


[Issue 9730] Allow ddoc unittests to remotely reference declaration

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9730



--- Comment #2 from hst...@quickfur.ath.cx 2013-03-20 07:23:40 PDT ---
I like this idea. Now that we have UDAs, let's make good use of them!

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


[Issue 7176] Lambda = syntax for function and methods too

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7176



--- Comment #17 from Kenji Hara k.hara...@gmail.com 2013-03-20 08:21:44 PDT 
---
I don't like this feature. Because:

1. it would reduce code readability.

   class LibClass {
 int foo() { return 1; }
 string bar() = hi;
   }

   Mixing lambda syntax and normal function syntax looks messy.

2. Just only reducing 7 character is too small benefit.

   auto foo()=expr;
   auto foo(){return expr;}

   With more complex function signature:

   ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...)=expr;
   ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...){return expr;}

   Ratio will fall further.

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


[Issue 9766] New: align(n) with n compile-time constant

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9766

   Summary: align(n) with n compile-time constant
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-03-20 11:10:12 PDT ---
enum uint myAlignment = 16;
align(myAlignment) struct Foo {}
void main() {}


DMD 2.063alpha gives:

temp.d(2): Error: positive integer expected, not myAlignment


With this a single compile-time constant change is enough to modify at the same
time and in the same way for different CPUs various alignments in the code.
It's good to be more DRY and avoid magic constants.

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


[Issue 9767] New: Confusing compiler error generated when names collide across modules.

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9767

   Summary: Confusing compiler error generated when names collide
across modules.
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: trivial
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrew.sm...@uk.mlp.com


--- Comment #0 from Andrew Smith andrew.sm...@uk.mlp.com 2013-03-20 11:10:22 
PDT ---
If I create two modules which contain duplicate declarations

a.d
=
module a;
import b;

import std.stdio;

void function() voidFun;

struct foo {
  typeof( voidFun ) onCb;
};

void myCb() {
  writefln(I've been called);
};

void main() {
  foo f = { myCb };
  usefoo(f);
};


and b.d
=
module b;

void function() voidFun;

struct foo {
  typeof(voidFun) onCb;
};


void usefoo( foo f) {
  f.onCb();
};

==

dmd produces following error message.

dmd -I. -c -ofa.o a.d
a.d(18): Error: function b.usefoo (foo f) is not callable using argument types
(foo)
a.d(18): Error: cannot implicitly convert expression (f) of type foo to foo
scons: *** [a.o] Error 1
scons: building terminated because of errors.




Obviously pilot error on my part but I'd argue the error message could be made
more helpful.

Cheers,

A.

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


[Issue 9763] @contended and @contended(groupName)

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9763



--- Comment #1 from bearophile_h...@eml.cc 2013-03-20 11:53:59 PDT ---
A current workaround is to use align (with a value, because of Issue 9766 ):


align(128) struct Test3 {
int field1;
int field2;
}
pragma(msg, Test3:);
pragma(msg, Test3.field1.offsetof);
pragma(msg, Test3.field2.offsetof);
pragma(msg, Total size:);
pragma(msg, Test3.sizeof);
pragma(msg, );


The print shows there is trailing padding (no leading padding):

Test3:
0u
4u
Total size:
128u


Adding align(128) on some fields of struct/object allows to introduce
intermediate padding, but it's tricky to get all the padding right. But
@contended adapts automatically the padding needed on different CPUs and makes
the creation of spaces and groups simpler.

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


[Issue 9760] asm docs should say PIC code uses variable and thus needs a stack frame

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9760



--- Comment #5 from Martin Nowak c...@dawg.eu 2013-03-20 13:19:46 PDT ---
(In reply to comment #3)
 The inline assembler doesn't give access to the complete set of relocation
 types. For those, it's best not to use naked and let the compiler set it up 
 for
 you.

BTW, this means I can't fix _trace_epi_n which gets called without saving
registers that belong to the callee.
Naked asm doesn't work because of the mentioned memory corruption and
the inability to load the GOT otherwise.
Normal asm doesn't work either, because the compiler trashes EAX when loading
the GOT.
I think the best solution would be to let the compiler do the regsave as it
does now for _c_trace_pro.

Also note that D doesn't have a possibility to mark a function local, i.e.
C++'s static, which wouldn't require a GOT entry to call in the first place.

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


[Issue 7176] Lambda = syntax for function and methods too

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7176



--- Comment #18 from timon.g...@gmx.ch 2013-03-20 13:33:49 PDT ---
(In reply to comment #17)
 I don't like this feature. Because:
 
 1. it would reduce code readability.
 

On the contrary! It also increases language consistency.

class LibClass {
  int foo() { return 1; }
  string bar() = hi;
}
 
Mixing lambda syntax and normal function syntax looks messy.
 

No. It is normal function syntax that looks messy in this case.

class LibClass {
auto foo() = 1;
auto bar() = hi;
}


 2. Just only reducing 7 character is too small benefit.
 

7*_N_ characters. Also, it can get rid of additional indentation.

auto foo()=expr;
auto foo(){return expr;}
 
With more complex function signature:
 
ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...)=expr;
ComplexReturnType!(..) foo(T, U, V)(T t, U u, V v) if (...){return expr;}
 
Ratio will fall further.

This is not a valid argument in any case.

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


[Issue 9474] Ddoc'd unittests should work correctly with interspersed version(none)

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9474


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 AssignedTo|andrej.mitrov...@gmail.com  |nob...@puremagic.com


--- Comment #6 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-20 
14:10:50 PDT ---
New pull by Kenji: https://github.com/D-Programming-Language/dmd/pull/1773

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


[Issue 9631] Error message not using fully qualified name when appropriate.

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9631


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 CC||andrew.sm...@uk.mlp.com


--- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-20 
14:30:53 PDT ---
*** Issue 9767 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 9768] New: No line number for wrong foreach type

2013-03-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9768

   Summary: No line number for wrong foreach type
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: diagnostic
  Severity: major
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2013-03-20 17:13:42 PDT ---
This is a wrong program:


import std.typecons: Tuple;
void main() {
Tuple!(string, int)[] data;
foreach (string first, second; data) {}
}



DMD 2.063alpha gives an error with no line number:

Error: cannot implicitly convert expression (0) of type int to string
test.d(4): Error: incompatible types for ((__key1671)  (__aggr1672.length)):
'string' and 'uint'
test.d(4): Error: '__key1671 += 1' is not a scalar, it is a string
test.d(4): Error: incompatible types for ((__key1671) += (1)): 'string' and
'int'
test.d(4): Error: cannot implicitly convert expression (__key1671) of type
string to uint


(Tagged with major priority according to a request by Don for errors with no
line number.)

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