Re: Postblit segfault.

2020-06-02 Thread MaoKo via Digitalmars-d-learn

On Tuesday, 2 June 2020 at 06:53:47 UTC, Basile B. wrote:


Ok cool. I hesitate to report an issue because the bug was too 
"simple".

This is a proof that dmd user use the GC a lot :).


Mmmmh I don't follow you, this has nothing to do with the GC. 
It's rather a problem with the backend (i.e the translation to 
an IR andthe generation of byte code)


Anyway someone already pushed a fix so next point release (~1 
or 2 weeks) will not produce invalid code for the case you've 
found.


Yes, ok I see. But anyway, thank for you help :D.



Re: Postblit segfault.

2020-06-02 Thread MaoKo via Digitalmars-d-learn

On Monday, 1 June 2020 at 19:52:39 UTC, Basile B. wrote:

On Monday, 1 June 2020 at 15:55:45 UTC, H. S. Teoh wrote:
On Mon, Jun 01, 2020 at 03:27:11PM +, Basile B. via 
Digitalmars-d-learn wrote: [...]
Possibly a backend bug (keyword "wrong code"), caused by 
either of [1] or

[2]

[1] https://github.com/dlang/dmd/pull/9357
[2] https://github.com/dlang/dmd/pull/9623/files


Yeah, it looks like a backend bug.  The struct address was 
somehow either not loaded correctly, or not passed correctly 
(didn't look into more detail which case).


A regression should be filed for this, if not already.


T


yeah done. culprit commit confirmed and reduced w/o phobos:

https://issues.dlang.org/show_bug.cgi?id=20890


Ok cool. I hesitate to report an issue because the bug was too 
"simple".

This is a proof that dmd user use the GC a lot :).



Postblit segfault.

2020-06-01 Thread MaoKo via Digitalmars-d-learn

Hello, I don't understand why this code segfault on Linux/FreeBSD:

import std.stdio;
struct _Poc {
  this(this) { writeln("_Poc.this(this)"); }
}
void main() {
  _Poc[1] valueArray = [ _Poc() ];
  writeln(valueArray);
}

I've just defined the postblit function in _Poc to see how much 
it's invoked.

In my system, it's invoked 3 time after the segfault.
When the array is allocated on the heap, nothing happen.
So I guess it's because it's located on the stack but why?

regard.


Re: Alias function declaration.

2020-05-20 Thread MaoKo via Digitalmars-d-learn

On Wednesday, 20 May 2020 at 04:50:42 UTC, user1234 wrote:

On Tuesday, 19 May 2020 at 22:04:49 UTC, MaoKo wrote:
Hello. I just want to find what is exactly the difference 
between:

alias _ = void function(int);
alias void _(int);
Because it's seem that the latter can't be used in the 
declaration of an array (eg: _[] ...).
I think the first is a pointer to function and the second is a 
function type itself but I'm not sure.


yes this is correct. To declare a function type using the first 
form is also possible:


alias TF1 = void(int);
alias void TF2(int);
static assert (is(TF1 == TF2));


Ok thanks you :D


Alias function declaration.

2020-05-19 Thread MaoKo via Digitalmars-d-learn

Hello. I just want to find what is exactly the difference between:
alias _ = void function(int);
alias void _(int);
Because it's seem that the latter can't be used in the 
declaration of an array (eg: _[] ...).
I think the first is a pointer to function and the second is a 
function type itself but I'm not sure.

Regard.