www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - possible codegen issue for ubyte params?

reply "Stefan Jonasson" <StefanJonasson hotbrev.com> writes:
http://dpaste.dzfl.pl/77b60e32

I must start by apologizing for the bad test program, since it's 
not fully minimal and requires 2 external binary files in order 
to reproduce. But any files seems to suffice, my test files are 
8k and the needle-file is not contained in the haystack-file.

// object.Error: Access Violation
algorithm.d(3609):
for (auto i = needle.save; !i.empty && !binaryFun!pred(i.back, 
needleBack);

DMD32 D Compiler v2.063.2

// This works fine
bool binaryFun_i(uint  a, uint  b) { return a==b; }

// object.Error: Access Violation
bool binaryFun_b(ubyte a, ubyte b) { return a==b; }

Also if compiling with -inline, the problem disappears, this is 
what gave me the "wild codegen theory". Basically I'm wondering 
if this is this a known issue, or if my program invalid?
Oct 11 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 11.10.2013 18:23, schrieb Stefan Jonasson:
 http://dpaste.dzfl.pl/77b60e32

 I must start by apologizing for the bad test program, since it's not
 fully minimal and requires 2 external binary files in order to
 reproduce. But any files seems to suffice, my test files are 8k and the
 needle-file is not contained in the haystack-file.

 // object.Error: Access Violation
 algorithm.d(3609):
 for (auto i = needle.save; !i.empty && !binaryFun!pred(i.back, needleBack);

 DMD32 D Compiler v2.063.2

 // This works fine
 bool binaryFun_i(uint  a, uint  b) { return a==b; }

 // object.Error: Access Violation
 bool binaryFun_b(ubyte a, ubyte b) { return a==b; }

 Also if compiling with -inline, the problem disappears, this is what
 gave me the "wild codegen theory". Basically I'm wondering if this is
 this a known issue, or if my program invalid?
Does this always happen or only when you specifiy -O? Because I think I have a codegen bug too which only appears when compiling with -O. It also involves a ubyte parameter. Kind Regards Benjamin Thaut
Oct 11 2013
parent "Stefan Jonasson" <StefanJonasson hotbrev.com> writes:
On Friday, 11 October 2013 at 18:42:42 UTC, Benjamin Thaut wrote:
 Does this always happen or only when you specifiy -O?
 Because I think I have a codegen bug too which only appears 
 when compiling with -O. It also involves a ubyte parameter.

 Kind Regards
 Benjamin Thaut
That's very interesting, thank you for the information! It always happens, regardless if '-O' is used or not. Best Regards, Stefan J
Oct 11 2013