Skip to content
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

Immediate crash when avx cpu feature is enabled when calling glfw::init in release mode #444

Open
daemonjax opened this issue Mar 14, 2020 · 1 comment

Comments

@daemonjax
Copy link

daemonjax commented Mar 14, 2020

Immediate crash when avx cpu feature is enabled when calling glfw::init:
the line: let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS.clone()).unwrap();

error: process didn't exit successfully: z:/rust_target\release\binary.exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

cpu: ivybridge (3570k)
target: stable-x86_64-pc-windows-msvc (default)
rustc version: rustc 1.42.0 (b8cedc004 2020-03-09)

[profile.release]
opt-level = 3
debug = false
debug-assertions = false
overflow-checks = false
lto = true
panic = 'abort'
incremental = false
codegen-units = 1

This is as close as I can get to cpu native before it crashes (e.g. the following runs fine unless i add avx, or set it to native or ivybridge):
rustflags = "-C target-cpu=x86-64 -C target-feature=+mmx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+aes,+clflushopt,+cmov,+cx16,+cx8,+ermsb,+fxsr,+mwaitx,+popcnt,+fsgsbase,+rdrnd"

Also, opt-level = 1 will not crash with avx cpu feature enabled.

I don't understand what avx has to do with grabbing an opengl context. Weird.

@daemonjax
Copy link
Author

daemonjax commented Mar 15, 2020

Nevermind I guess.
It magically started working (even simply using target-cpu=native or ivybridge). The only thing I changed is adding more code to the project. Coinflip odds on it hanging (0% cpu usage) when building glfw-sys with +avx -- I just ctrl-c and rerun "cargo build --release" and it then builds fine. No idea why.

Can close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant