Thread overview
Region allocator strage error
Jan 31, 2016
ref2401
Feb 01, 2016
ref2401
Feb 01, 2016
Marc Schütz
Feb 01, 2016
mark_mcs
Feb 01, 2016
mark_mcs
Feb 01, 2016
mark_mcs
January 31, 2016
I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure

if LEN equals to 3, 5, 7, 9, ...

void main(string[] args) {
	ubyte[1024] memory;
	auto stackAlloc = Region!NullAllocator(memory);
	IAllocator alloc = allocatorObject(&stackAlloc);

	enum LEN = 11;
	float[] arr = alloc.makeArray!float(LEN);
	alloc.expandArray(arr, LEN);
}

OS: win 8.1 Enterprise x64
DMD: 2070.0
platformAlignment: 8

Any thoughts?
Thank you.
February 01, 2016
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
> I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure

At least tell me can anyone replicate it?
February 01, 2016
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
> On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
>> I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
>
> At least tell me can anyone replicate it?

Missing imports for c&p:
import std.experimental.allocator;
import std.experimental.allocator.building_blocks;

I can't reproduce it on Linux x86_64, neither with latest DMD from git, nor DMD 2.070.0.

It's the following assert, maybe it helps finding the cause:
https://github.com/D-Programming-Language/phobos/blob/master/std/experimental/allocator/building_blocks/region.d#L235
February 01, 2016
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
> On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
>> I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
>
> At least tell me can anyone replicate it?

Reproduced on Windows 7 Pro x64 and Windows 10 Pro x64, DMD 2.070 and 2.069.2. I don't have any 32-bit machines to test. I'll try and debug later.
February 01, 2016
On Monday, 1 February 2016 at 19:55:26 UTC, mark_mcs wrote:
> On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
>> On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
>>> I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
>>
>> At least tell me can anyone replicate it?
>
> Reproduced on Windows 7 Pro x64 and Windows 10 Pro x64, DMD 2.070 and 2.069.2. I don't have any 32-bit machines to test. I'll try and debug later.

This should fail on 64-bit Linux builds.

import std.experimental.allocator;
import std.experimental.allocator.building_blocks;

void main(string[] args) {
    ubyte[1024] memory;
    auto alloc = Region!NullAllocator(memory);

    auto result = alloc.allocate(20);
    alloc.expand(result, 20);
}


February 01, 2016
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
> On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
>> I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
>
> At least tell me can anyone replicate it?

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

(Sorry for the *triple* post).