Created attachment 1673
ASan log
Occured while running compilable/test11559upgradeoptlink.d.
=================================================================
==12572==ERROR: AddressSanitizer: stack-overflow on address 0x7ffef7005ff8 (pc 0x000000c5bda3 bp 0x7ffef70060b0 sp 0x7ffef7005500 T0)
#0 0xc5bda2 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5bda2)
#1 0xc5dcad in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dcad)
#2 0xc5dd8f in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dd8f)
#3 0xc5dd8f in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5dd8f)
#4 0xc5c4e8 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5c4e8)
#5 0xc7cc28 in eloror(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc7cc28)
...
#250 0xc5c4e8 in optelem(elem*, unsigned int) (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5c4e8)
SUMMARY: AddressSanitizer: stack-overflow (/home/dawg/Code/D/DPL/dmd/generated/linux/release/64/dmd+0xc5bda2) in optelem(elem*, unsigned int)
==12572==ABORTING
==============================
Comment #1 by bugzilla — 2018-01-04T00:21:35Z
The failing test case is:
string gen() {
string m;
foreach(i; 0..4096)
m ~= "mixin(\"assert(0);\n\n\n\n\");\n";
return m;
}
void main() {
mixin(gen());
}
Comment #2 by bugzilla — 2018-01-04T00:25:45Z
This is a stack overflow caused by having 4096 expression statements. The compiler joins them with a commaexpression, and then recursively traverses it. The best fix would be to convert it to an array or list of expression statements, but that would have ripple effects throughout the back end.
Comment #3 by code — 2018-01-04T21:37:51Z
Not sure it's worthwhile to fix it, maybe just add a recursion limit to optelem?
Comment #4 by robert.schadek — 2024-12-13T18:55:59Z