digitalmars.D.learn - dmd -O causes incorrect output
- Saurabh Das (28/28) Jan 25 2021 I'm seeing what appears to be a bug with the -O flag in dmd. Here
- H. S. Teoh (11/17) Jan 25 2021 It's probably a bug. File a bug on bugzilla: https://issues.dlang.org
- Saurabh Das (2/17) Jan 25 2021 LDMD2 seems to not suffer from this issue.
- H. S. Teoh (9/17) Jan 25 2021 [...]
- Saurabh Das (2/20) Jan 25 2021 Thanks for the inputs. I'll fill a bug report about it.
I'm seeing what appears to be a bug with the -O flag in dmd. Here
is a reduced test case:
struct SomeStruct
{
long value;
}
bool isNumberOne(int i)
{
SomeStruct l;
if(i == 1)
l = SomeStruct(10);
return (l == SomeStruct(10));
}
void main()
{
if (!isNumberOne(1))
assert(false);
}
See: https://run.dlang.io/is/zlrDvy
The assert trips when run with "rdmd -O test.d" and it does not
trip when run with "rdmd test.d".
This bug is observed in all compiler versions from dmd-2.060
through to dmd-2.095! Please shed some light on the issue – any
help would be greatly appreciated.
Thanks,
Saurabh
Jan 25 2021
On Mon, Jan 25, 2021 at 06:07:46PM +0000, Saurabh Das via Digitalmars-d-learn wrote:I'm seeing what appears to be a bug with the -O flag in dmd.[...]The assert trips when run with "rdmd -O test.d" and it does not trip when run with "rdmd test.d".It's probably a bug. File a bug on bugzilla: https://issues.dlang.orgThis bug is observed in all compiler versions from dmd-2.060 through to dmd-2.095! Please shed some light on the issue – any help would be greatly appreciated.[...] DMD's backend is known to have obscure bugs that crop up every so often. If this issue is being a showstopper, consider switching to LDC or GDC instead. (You might want to try the same code with LDC/GDC anyway, just to see whether they have the same problem. My guess is they don't.) T -- People demand freedom of speech to make up for the freedom of thought which they avoid. -- Soren Aabye Kierkegaard (1813-1855)
Jan 25 2021
On Monday, 25 January 2021 at 18:19:24 UTC, H. S. Teoh wrote:On Mon, Jan 25, 2021 at 06:07:46PM +0000, Saurabh Das via Digitalmars-d-learn wrote:LDMD2 seems to not suffer from this issue.[...][...][...]It's probably a bug. File a bug on bugzilla: https://issues.dlang.org[...][...] DMD's backend is known to have obscure bugs that crop up every so often. If this issue is being a showstopper, consider switching to LDC or GDC instead. (You might want to try the same code with LDC/GDC anyway, just to see whether they have the same problem. My guess is they don't.) T
Jan 25 2021
On Mon, Jan 25, 2021 at 06:45:43PM +0000, Saurabh Das via Digitalmars-d-learn wrote:On Monday, 25 January 2021 at 18:19:24 UTC, H. S. Teoh wrote:[...][...]It's probably a bug. File a bug on bugzilla: https://issues.dlang.org[...]DMD's backend is known to have obscure bugs that crop up every so often. If this issue is being a showstopper, consider switching to LDC or GDC instead. (You might want to try the same code with LDC/GDC anyway, just to see whether they have the same problem. My guess is they don't.)LDMD2 seems to not suffer from this issue.No surprise there. I recommend using LDC (ldmd2) instead. Still file the bug, though, so that somebody will fix it eventually. T -- There is no gravity. The earth sucks.
Jan 25 2021
On Monday, 25 January 2021 at 19:18:47 UTC, H. S. Teoh wrote:On Mon, Jan 25, 2021 at 06:45:43PM +0000, Saurabh Das via Digitalmars-d-learn wrote:Thanks for the inputs. I'll fill a bug report about it.On Monday, 25 January 2021 at 18:19:24 UTC, H. S. Teoh wrote:[...][...]It's probably a bug. File a bug on bugzilla: https://issues.dlang.org[...]DMD's backend is known to have obscure bugs that crop up every so often. If this issue is being a showstopper, consider switching to LDC or GDC instead. (You might want to try the same code with LDC/GDC anyway, just to see whether they have the same problem. My guess is they don't.)LDMD2 seems to not suffer from this issue.No surprise there. I recommend using LDC (ldmd2) instead. Still file the bug, though, so that somebody will fix it eventually. T
Jan 25 2021








Saurabh Das <saurabh.das gmail.com>