Created attachment 67 [details] sample gdc -O1 and gdc -O2 produces faulty code for Adam Ruppe's jsvar.d. how to reproduce: get jsvar.d from here: https://github.com/adamdruppe/arsd/blob/master/jsvar.d comment out line 47 (version=new_std_json;) compile attached sample with -O0 and run it. it works ok. compile attached sample with -O1 (or -O2) and run it. it segfaults.
Actually, optimizer produces faulty code for main.d, not for jsvar.d. it's ok to compile jsvar.d with -O2, but main.d with -O2 will segfault.
I can't say I can reproduce this problem easily.
sorry, i can't reduce it to small sample. but it's surely reproducable with 83b13e and gcc 4.9. i can attach that jsvar.d too (but it's really stock one from git) and anything you need to reproduce it. note that it's 32-bit compiler. i can't test it on 64 bit.
just build jsvar.d, and then my main.d with -O2 — and you'll get segfault. it's not heisenbug.
this bug disappeared in current gdc 4.9, so i think that it can be closed as "unconfirmed", 'cause even I can't reproduce it anymore.
Bleh, lets just say worksforme.