Skip to content

Making a value for uninhabited type is compiled to SIGILL on Nightly but only in Release mode #50976

Closed
@vitalyd

Description

@vitalyd

https://users.rust-lang.org/t/help-to-find-root-cause-of-illegal-hardware-instruction/17600/7 gets right to the thick of things. Basically, this playground demonstrates the SIGILL due to compiler emitting a ud2 instruction as a result of the UB hit when trying to make a value for libc::timezone (an empty enum). However, this only happens on nightly and release (optimized) mode.

My concern is this type of thing will likely bite users, who may have (unintentionally) done something silly like the example above (why does libc define timezone as an empty enum? I'm not sure). But my questions are mostly:

  1. Is this an expected change in nightly?
  2. Is it expected that only optimized (release) builds hit this? Why isn't a debug building compiling to the same thing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions