Skip to content

Illegal instruction (core dumped) with function pointers #3812

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

Closed
dckc opened this issue Oct 19, 2012 · 4 comments
Closed

Illegal instruction (core dumped) with function pointers #3812

dckc opened this issue Oct 19, 2012 · 4 comments
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@dckc
Copy link
Contributor

dckc commented Oct 19, 2012

code is in https://gist.github.com/3913762 (is there a better way to attach it?)

the problem is somewhere during the call to
bobMainPurse.deposit(10, aliceMainPurse);

With that line commented out, it runs.

deposit involves passing around function pointers.

@catamorphism
Copy link
Contributor

gist is fine. If there's any way you could try to minimize the code so it shows the same error but is smaller, that would be much appreciated. If not, that's ok.

@Blei
Copy link
Contributor

Blei commented Oct 19, 2012

Heh, interesting binary... I seem to get about 50% each a segmentation fault or an illegal hardware instruction. Once I even got a bus error...

It feels very much like the generated code is jumping somewhere it shouldn't jump to. Maybe a broken virtual table of one of the trait instances?

@catamorphism
Copy link
Contributor

@dckc - The gist seems to have disappeared -- is there any way you can copy/paste the code as a comment? Thanks...

@pcwalton
Copy link
Contributor

This needs updating for newest @Trait syntax; closing. Please feel free to reopen if this still happens when updated (the generated trans code has changed).

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 9, 2022
Unlike past similar work done in rust-lang#6228, expand the existing `or_fun_call`
lint to detect `or_insert` calls with a `T::new()` or `T::default()`
argument, much like currently done for `unwrap_or` calls. In that case,
suggest the use of `or_default`, which is more idiomatic.

Note that even with this change, `or_insert_with(T::default)` calls
aren't detected as candidates for `or_default()`, in the same manner
that currently `unwrap_or_else(T::default)` calls aren't detected as
candidates for `unwrap_or_default()`.

Also, as a nearby cleanup, change `KNOW_TYPES` from `static` to `const`,
since as far as I understand it's preferred (should Clippy have a lint
for that?).

Fixes rust-lang#3812.
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 9, 2022
Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`

Unlike past similar work done in rust-lang#6228, expand the existing `or_fun_call`
lint to detect `or_insert` calls with a `T::new()` or `T::default()`
argument, much like currently done for `unwrap_or` calls. In that case,
suggest the use of `or_default`, which is more idiomatic.

Note that even with this change, `or_insert_with(T::default)` calls
aren't detected as candidates for `or_default()`, in the same manner
that currently `unwrap_or_else(T::default)` calls aren't detected as
candidates for `unwrap_or_default()`.

Also, as a nearby cleanup, change `KNOW_TYPES` from `static` to `const`,
since as far as I understand it's preferred (should Clippy have a lint
for that?).

Addresses rust-lang#3812.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`or_fun_call`]: Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 18, 2024
epoll: iterate through output buffer then fetch an event from ready list

Fixes rust-lang#3812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

4 participants