D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19343 - [regression] SROA breaks valid code with -O
Summary: [regression] SROA breaks valid code with -O
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-10-30 15:59 UTC by Stefan Koch
Modified: 2018-12-11 06:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stefan Koch 2018-10-30 15:59:53 UTC
The bug appears when compiling the following code with -O

void f(real x) {(x) {} (x); ulong m = *cast(ulong *) &x;}

The compiler will assert fixresult_x87() in cg87.c because the size of the elem is bigger then DBLSIZE (usually 8).
it seems that for some reason the enregistering of &x, is not undone.
before extracting the first 64 bits of it.

This is a rather serious bug which hints towards further problems inside the SORA code.
Comment 1 Stefan Koch 2018-10-30 16:02:16 UTC
Introduced in: https://github.com/dlang/dmd/pull/6192
Comment 2 Walter Bright 2018-12-11 06:45:24 UTC
I cannot reproduce this:

1. there is no cg87.c anymore, it is cg87.d

2. there is no fixresult_x87(), did you mean fixresult87() ?

3. which line asserts?

4. I cannot get this code to even wind up in fixresult87()

5. I tried it on Win32 and Win64

Please reopen if you can get it to fail with the current version of DMD.