[Issue 20441] New: Wrong code with -O -fPIC and string literal.ptr
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 10 17:02:37 UTC 2019
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: nobody at puremagic.com
Reporter: clugdbug at 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 );
}
---
--
More information about the Digitalmars-d-bugs
mailing list