Closed pnkfelix closed 6 years ago
My current assumptions:
rustfix
generated one) is just broken and we should not be attempting to link it.// compile-pass
(or perhaps it really should be // skip-trans
, once support for that lands in the ui suite)
// run-rustfix
architecture supports that sort of .fixed
-conditionalized property)extern u8 C;
to an auxiliary file, and leave the original as a normal (i.e. implicitly compile-fail) ui
test.nominating for discussion at compiler team meeting.
IMO not-a-bug.
It is possible to make this sort of case behave consistently regardless of the compilation mode (to make it consistently succeed, a weak definition could be provided, but that seems kind of insane thing to do; to make it consistently fail a non-optimisable reference to the declaration would have to be generated).
However, the current behaviour is already fairly consistent across all the toolchains I’ve used so far and has its own benefits as well (not having to generate extra code for example)
discussed at T-compiler meeting
But it was at the end of the meeting and I decided, based on the opinions put forward, we should not attempt to reach any final conclusions in a five minute discussion
@nagisa I just want to clarify: when you say "not-a-bug", you are saying the current behavior of rustc is not a bug in rustc, right?
(As opposed to, e.g., "the test is not buggy")
That is my reading of the paragraphs you wrote after the "not-a-bug", but I just wanted to double-check.
Your interpretation is correct.
On Thu, Sep 20, 2018, 18:51 Felix S Klock II notifications@github.com wrote:
@nagisa https://github.com/nagisa I just want to clarify: when you say "not-a-bug", you are saying the current behavior of rustc is not a bug in rustc, right?
(As opposed to, e.g., "the test is not buggy")
That is my reading of the paragraphs you wrote after the "not-a-bug", but I just wanted to double-check.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust/issues/54388#issuecomment-423233895, or mute the thread https://github.com/notifications/unsubscribe-auth/AApc0gCeHRWRGbK7R7OTU4u8bi-qF4hjks5uc7lvgaJpZM4WyJPW .
Spawned off of https://github.com/rust-lang/rust/pull/54188#issuecomment-423172455
Right now we have a "test" that is auto-generated (via
rustfix
) that looks like this:https://github.com/rust-lang/rust/blob/f7f4c500b46603386e940f116b469c7adc043a6d/src/test/ui/extern/extern-const.fixed#L12-L25
Note that there aren't any definitions provided for that
extern "C" { static C: u8; }
; we haven't linked in any code that gives a definition for it.Today,
rustc
will compile that code without complaint (as long as you don't add the-g
to the command line). And you can even run it.Likewise,
cargo build --release
will also compile without complaint: playbut
cargo build
(developer aka debug mode) says this (play):So my hypothesis is that LLVM is managing to optimize the code enough that it doesn't notice the missing extern symbol definiton.
(But for some reason, after applying #54188, in some scenarios it does start to notice the missing extern symbol definition.)