https://issues.dlang.org/show_bug.cgi?id=20441
Issue ID: 20441 Summary: Wrong code with -O -fPIC and string literal.ptr Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: clugd...@yahoo.com.au This reduced test case tested with 2.086, but original bug was found with 2.089 and 2.078. Assert fails if compiled with -O -fPIC. Passes if compiled without -O. --- const(char)* moo(const (char) *s) { return s; } void main () { const(char) *x = "abc".ptr; assert( moo(x) - x == 0 ); } --- --