Bug 14560 – [REG2.058] Strange -inline behavior

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-08T19:21:00Z
Last change time
2015-06-17T21:05:59Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
chalucha

Comments

Comment #0 by chalucha — 2015-05-08T19:21:23Z
I had a problem with vibe.d which I've dustmited to code below. Problem is that whet I use -inline switch (used by dub with -b release), program fails. Without it it is ok. GDC and LDC2 works ok. I don't understand what is happening here, but I guess the problem can be with serialize function overrides with different results? But then why it runs ok with foreach removed in serializeImpl? import std.traits; struct JsonStringSerializer { void getSerializedResult() { } } void serializeToJson(T)(T value) { serialize!(JsonStringSerializer)(value); } auto serialize(Serializer, T)(T value) { auto serializer = Serializer(); serialize(serializer, value); return serializer.getSerializedResult; } void serialize(Serializer, T)(Serializer serializer, T value) { serializeImpl!(Serializer, T)(serializer, value); } void serializeImpl(Serializer, T)(Serializer , T value) { foreach (i; value) { } } int main() { serializeToJson(["test"]); return 0; }
Comment #1 by dlang-bugzilla — 2015-05-09T20:33:51Z
Comment #2 by mk — 2015-05-10T11:21:34Z
What is the expected error here ? I don't get any output or compilation error.
Comment #3 by dlang-bugzilla — 2015-05-10T11:24:26Z
Non-zero exit code
Comment #4 by mk — 2015-05-10T12:54:14Z
Fails since 2.058 on x86 and since 2.066 on x86_64, marked reg 2.066 for now.
Comment #5 by k.hara.pg — 2015-06-13T07:19:19Z
Reduced test case: auto serialize(T)(T value) { foreach (i; value) { } return; // important } int main() { serialize(["test"]); return 0; } Compiler fix: https://github.com/D-Programming-Language/dmd/pull/4743
Comment #6 by github-bugzilla — 2015-06-13T09:08:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9f886976493597585085894a49f7a39d5425bdab fix Issue 14560 - Strange -inline behavior https://github.com/D-Programming-Language/dmd/commit/ca9bbd65d784f21f069b612e5eada7f977b2d5cb Merge pull request #4743 from 9rnsr/fix14560 [REG2.058] Issue 14560 - Strange -inline behavior
Comment #7 by github-bugzilla — 2015-06-17T21:05:59Z