ldc-developers/ldc — Issue #47: Compile-time segfault involving libpthread, _aaGet
Author: dsimcha
Created: 2011-12-11 05:16:49+00:00
State: open

This one must be a memory management issue or something because it's deterministic but chaotic. It only happens at -O3 or greater optimization settings (implying that it's codegen related), yet can only be reproduced when templates that are never instantiated and code that's versioned out are included (implying it's in the front end) and only with multiple modules.

Since this bug report involves multiple files and cannot be reproduced if they're all concatenated, I've temporarily added a zip file to the relevant project's Git repo, at https://github.com/dsimcha/dstats/blob/master/summaryLdc.zip . After unzipping, trying to compile bug.d gets the following results:

$ldmd2 -O5 bug.d
0 ldc2 0x0000000001004eaf
1 ldc2 0x0000000001005399
2 libpthread.so.0 0x00007f7ab8a33020
3 ldc2 0x000000000062beea _aaGet(AA**, void*) + 26
4 ldc2 0x00000000006127dc BinExp::arrayOp(Scope*) + 364
5 ldc2 0x00000000006199cb ExpStatement::semantic(Scope*) + 27
6 ldc2 0x0000000000624ce4 CompoundStatement::semantic(Scope*) + 196
7 ldc2 0x000000000061c18b ForStatement::semantic(Scope*) + 251
8 ldc2 0x000000000061d1b6 ForeachRangeStatement::semantic(Scope*) + 854
9 ldc2 0x0000000000624ce4 CompoundStatement::semantic(Scope*) + 196
10 ldc2 0x00000000005e9c22 FuncDeclaration::semantic3(Scope*) + 2434
11 ldc2 0x0000000000630632 AttribDeclaration::semantic3(Scope*) + 66
12 ldc2 0x0000000000614c08 Module::semantic3(Scope*) + 88
13 ldc2 0x00000000005ce67c main + 7580
14 libc.so.6 0x00007f7ab7b07ead __libc_start_main + 253
15 ldc2 0x00000000005dda0d
Segmentation fault