-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot compile regex: illegal hardware instruction #23032
Comments
(Btw, this seems to be happening during |
For valgrind output: rust-lang/regex#51 (comment) |
Not strictly an ICE, but close enough |
This is still an issue using Rust 1.0 beta 2
|
Backtrace? |
No luck getting a backtrace:
At the time of writing, this is still an issue on stable, beta, and nightly channels |
A somewhat more clear testcase: static ALNUM: &'static u32 = &1;
static C:u32 = *(&/*implicit deref*/ALNUM as &'static u32);
fn main() { println!("{}", C); } |
Err, a much more clear testcase: static ALNUM: &'static u32 = &1;
static C:u32 = **&ALNUM;
fn main() {} |
@eefriedman Both of those examples seem to not cause an ICE: |
If you flip the declaration of C and ALNUM, it ICEs. The accepts-invalid and crash-on-invalid are essentially two variants of the same issue. |
bt:
|
In the end I think this comes down to the compiler permitting access to statics when it should not. The mechanism in const_check is basically not smart enough, but fixing this requires a whole bunch of new machinery and I don't think it is currently worth the effort. |
You don't even need the double-deref: static BAR: u32 = *&FOO;
static FOO: u32 = 4;
fn main() {} If we don't make this work, we should probably ban all derefs in constants. |
Compiling these examples now leads to:
Shall we close this? Do we want a new regression test first? |
I think @steveklabnik knows the answer to this, since he runs Glacier. |
Yeah, I'm going to close, there are tests in-tree that verify this behavior. |
The new nightly caused this in regex: rust-lang/regex#50 - the fix is trivial, but it uncovers an illegal hardware instruction that seems to be a bug in rustc.
So far I have (disclaimer: the code is taken from regex)
(playpen)
It seems to be related to f35f973, which changes a lot of
static
s toconst
s. In the above example, changing thestatic
modifier ofALNUM
toconst
also allows this to compile, so there is a workaround, but it still seems like a bug that should be addressed.See:
The text was updated successfully, but these errors were encountered: