Bug 13470 – Crash with final struct containing anonymous union
Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-09-13T21:12:00Z
Last change time
2017-07-02T17:18:22Z
Assigned to
nobody
Creator
chss95cs
Comments
Comment #0 by chss95cs — 2014-09-13T21:12:41Z
The only changes I had made between the last build and the one that prompted the crash was the addition of a new struct type
The structure definition:
http://pastebin.com/bLEDG4KJ
The crash report:
radverbial@radverbial-M68MT-D3:~/dansworld$ ./build.sh
dmd: struct.c:419: static void AggregateDeclaration::alignmember(structalign_t, unsigned int, unsigned int*): Assertion `alignment > 0 && !(alignment & (alignment - 1))' failed.
./build.sh: line 6: 8068 Aborted (core dumped) dmd main_o.d templates.d engine/dialogue.d engine/base.d engine/entity.d engine/entities.d engine/area.d engine/areas.d engine/world_o.d engine/item.d engine/items.d basic_types.d system_o.d -release -O -inline
Comment #1 by k.hara.pg — 2015-01-20T07:13:02Z
(In reply to 1199223 from comment #0)
> The structure definition:
> http://pastebin.com/bLEDG4KJ
Do not use external website to show issue code. It may be lost accidentally.
And, your code is not enough to reproduce compiler crash. The code:
public final struct Object
{
@safe public final pure
{
mixin(__ObjCtor("Tangible"));
mixin(__ObjCtor("Entity"));
mixin(__ObjCtor("Item"));
mixin(__ObjChk("is_entity", "OBJ_Entity"));
mixin(__ObjChk("is_tangible", "OBJ_Tangible"));
mixin(__ObjChk("is_item", "OBJ_Item"));
}
private enum : uint8
{
OBJ_Tangible = 0,
OBJ_Item,
OBJ_Entity
}
uint8 identity=0;
uint8 flags=0;
union
{
Item Item_;
Entity Entity_;
Tangible Tangible_;
};
}
Prints:
test.d(5): Error: undefined identifier __ObjCtor
test.d(6): Error: undefined identifier __ObjCtor
test.d(7): Error: undefined identifier __ObjCtor
test.d(9): Error: undefined identifier __ObjChk
test.d(10): Error: undefined identifier __ObjChk
test.d(11): Error: undefined identifier __ObjChk
test.d(13): Error: undefined identifier uint8
test.d(19): Error: undefined identifier uint8
test.d(20): Error: undefined identifier uint8
test.d(23): Error: undefined identifier Item, did you mean variable Item_?
test.d(24): Error: undefined identifier Entity, did you mean variable Entity_?
test.d(25): Error: undefined identifier Tangible, did you mean variable Tangible_?
With the latest release 2.066.1.
Comment #2 by dlang-bugzilla — 2017-07-02T17:18:22Z
Incomplete testcase, no reply in 2 years, closing.