Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 125 - Optimizer produces faulty code
Summary: Optimizer produces faulty code
Status: RESOLVED WORKSFORME
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: x86 Linux
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-05-16 15:35 CEST by Ketmar Dark
Modified: 2014-07-21 12:20 CEST (History)
1 user (show)

See Also:


Attachments
sample (139 bytes, text/plain)
2014-05-16 15:35 CEST, Ketmar Dark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ketmar Dark 2014-05-16 15:35:26 CEST
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.
Comment 1 Ketmar Dark 2014-05-16 15:59:15 CEST
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.
Comment 2 Iain Buclaw 2014-05-18 17:42:05 CEST
I can't say I can reproduce this problem easily.
Comment 3 Ketmar Dark 2014-05-19 06:13:36 CEST
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.
Comment 4 Ketmar Dark 2014-05-19 06:14:58 CEST
just build jsvar.d, and then my main.d with -O2 — and you'll get segfault. it's not heisenbug.
Comment 5 Ketmar Dark 2014-06-14 16:14:34 CEST
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.
Comment 6 Iain Buclaw 2014-07-21 12:20:30 CEST
Bleh, lets just say worksforme.