Skip to content

rustc fails if passed -g -g; make check breaks under --enable-debug. #24937

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
pnkfelix opened this issue Apr 29, 2015 · 4 comments · Fixed by #24945
Closed

rustc fails if passed -g -g; make check breaks under --enable-debug. #24937

pnkfelix opened this issue Apr 29, 2015 · 4 comments · Fixed by #24945

Comments

@pnkfelix
Copy link
Member

rustc fails if passed -g -g:

% ./x86_64-apple-darwin/stage1/bin/rustc -g -g /tmp/f.rs
error: Option 'g' given more than once.

make check breaks:

% grep -i configure_args config.mk
CFG_CONFIGURE_ARGS   := --enable-debug --enable-optimize --enable-ccache --enable-clang --prefix=~/opt/rust-dbg --disable-optimize-tests --disable-llvm-assertions
% make check-stage1
...
failures:

---- [run-pass] run-pass/backtrace-debuginfo.rs stdout ----

error: compilation failed!
status: exit code: 101
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/backtrace-debuginfo.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/backtrace-debuginfo.stage1-x86_64-apple-darwin.run-pass.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/run-pass/backtrace-debuginfo.stage1-x86_64-apple-darwin --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt -g
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: Option 'g' given more than once.

------------------------------------------

thread '[run-pass] run-pass/backtrace-debuginfo.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512


---- [run-pass] run-pass/dst-trait.rs stdout ----

error: compilation failed!
status: signal: 6
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-trait.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/dst-trait.stage1-x86_64-apple-darwin.run-pass.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/run-pass/dst-trait.stage1-x86_64-apple-darwin --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-trait.rs:12:10: 12:26 warning: lint unknown_features has been renamed to unused_features
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-trait.rs:12 #![allow(unknown_features)]
                                                                             ^~~~~~~~~~~~~~~~
Assertion failed: (Idx < NumElements && "Invalid element idx!"), function getElementOffset, file ../../../../../src/llvm/include/llvm/IR/DataLayout.h, line 484.

------------------------------------------

thread '[run-pass] run-pass/dst-trait.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512


---- [run-pass] run-pass/dst-struct.rs stdout ----

error: compilation failed!
status: signal: 6
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-struct.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/dst-struct.stage1-x86_64-apple-darwin.run-pass.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/run-pass/dst-struct.stage1-x86_64-apple-darwin --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-struct.rs:12:10: 12:26 warning: lint unknown_features has been renamed to unused_features
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/dst-struct.rs:12 #![allow(unknown_features)]
                                                                              ^~~~~~~~~~~~~~~~
Assertion failed: (Idx < NumElements && "Invalid element idx!"), function getElementOffset, file ../../../../../src/llvm/include/llvm/IR/DataLayout.h, line 484.

------------------------------------------

thread '[run-pass] run-pass/dst-struct.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512


---- [run-pass] run-pass/import-crate-with-invalid-spans.rs stdout ----

error: auxiliary build of "/Users/fklock/Dev/Mozilla/rust-gc/src/test/auxiliary/crate_with_invalid_spans.rs" failed to compile: 
status: exit code: 101
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/auxiliary/crate_with_invalid_spans.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/import-crate-with-invalid-spans.stage1-x86_64-apple-darwin.run-pass.libaux --out-dir x86_64-apple-darwin/test/run-pass/import-crate-with-invalid-spans.stage1-x86_64-apple-darwin.run-pass.libaux --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt -g
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: Option 'g' given more than once.

------------------------------------------

thread '[run-pass] run-pass/import-crate-with-invalid-spans.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512


---- [run-pass] run-pass/match-arm-statics.rs stdout ----

error: compilation failed!
status: exit code: 101
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/match-arm-statics.stage1-x86_64-apple-darwin.run-pass.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/run-pass/match-arm-statics.stage1-x86_64-apple-darwin --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt
stdout:
------------------------------------------
thread 'rustc' panicked at 'Box<Any>', /Users/fklock/Dev/Mozilla/rust-gc/src/libsyntax/diagnostic.rs:170



------------------------------------------
stderr:
------------------------------------------
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:25:5: 25:19 warning: variant is never used: `Variant1`, #[warn(dead_code)] on by default
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:25     Variant1(bool),
                                                                                ^~~~~~~~~~~~~~
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:85:21: 85:26 warning: variant is never used: `E`, #[warn(dead_code)] on by default
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:85     enum C { D = 3, E = 4 }
                                                                                                ^~~~~
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:135:9: 135:19 error: internal compiler error: debuginfo: Could not find scope info for node NodeExpr(Expr { id: 48, node: ExprLit(Spanned { node: LitBool(false), span: Span { lo: BytePos(868), hi: BytePos(873), expn_id: ExpnId(4294967295) } }), span: Span { lo: BytePos(868), hi: BytePos(873), expn_id: ExpnId(4294967295) } })
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:135         STATIC_FOO => 3,
                                                                                     ^~~~~~~~~~
<std macros>:1:1: 9:39 note: in expansion of assert_eq!
/Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/match-arm-statics.rs:132:5: 141:11 note: expansion site
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace

------------------------------------------

thread '[run-pass] run-pass/match-arm-statics.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512


---- [run-pass] run-pass/unboxed-closures-unique-type-id.rs stdout ----

error: compilation failed!
status: exit code: 101
command: x86_64-apple-darwin/stage1/bin/rustc /Users/fklock/Dev/Mozilla/rust-gc/src/test/run-pass/unboxed-closures-unique-type-id.rs -L x86_64-apple-darwin/test/run-pass/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/run-pass/unboxed-closures-unique-type-id.stage1-x86_64-apple-darwin.run-pass.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/run-pass/unboxed-closures-unique-type-id.stage1-x86_64-apple-darwin --cfg rtopt --cfg debug -g -L x86_64-apple-darwin/rt -g
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: Option 'g' given more than once.

------------------------------------------

thread '[run-pass] run-pass/unboxed-closures-unique-type-id.rs' panicked at 'explicit panic', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/runtest.rs:1512



failures:
    [run-pass] run-pass/backtrace-debuginfo.rs
    [run-pass] run-pass/dst-struct.rs
    [run-pass] run-pass/dst-trait.rs
    [run-pass] run-pass/import-crate-with-invalid-spans.rs
    [run-pass] run-pass/match-arm-statics.rs
    [run-pass] run-pass/unboxed-closures-unique-type-id.rs

test result: FAILED. 2025 passed; 6 failed; 35 ignored; 0 measured

thread '<main>' panicked at 'Some tests failed', /Users/fklock/Dev/Mozilla/rust-gc/src/compiletest/compiletest.rs:256
make: *** [tmp/check-stage1-T-x86_64-apple-darwin-H-x86_64-apple-darwin-rpass.ok] Error 101
@pnkfelix
Copy link
Member Author

(This looks easy to fix. It probably was a consequence of adding -g to --enable-debug, though if that's true, it seems sad that the original author of that patch must not have run make check under --enable-debug after doing this?)

@pnkfelix
Copy link
Member Author

(there is also a IMO reasonable argument that the better fix here would be to make it so that --enable-debug's addition of -g into the compilation flags when building the compiler and libraries has no effect on the flags used for running the test suite; the latter was not the fix I was originally aiming for, but it may be an appropriate change as well.)

@tamird
Copy link
Contributor

tamird commented Apr 29, 2015

I think I was probably the author of said patch :(

Anyway, looks like there's a natural place to strip -g from the test suite: https://github.com/rust-lang/rust/blob/master/mk/tests.mk#L625

I'll open that PR in a few hours if you don't beat me to it.

@pnkfelix
Copy link
Member Author

I'm about to take care of it. :)

Update: anyway, no worries about the misstep; after all, I'm the one who r-plus'ed it.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 29, 2015
Fixes for -g handling

First:
 * decouples our handling of `-g` for the test suite from our handling of `-g` for the rest of the compiler/stdlib building.
 * Namely, if you do `--enable-debug` or `--enable-debuginfo`, that should only affect `rustc` and the standard library crates; the tests should all continue to compile without `-g` unless:
   * you pass `--enable-debuginfo-tests`, or
   * the test itself requests the `-g` option (e.g. via a `// compile-flags: -g` embedded comment).

Second:
 * Makes `rustc` more flexible in that it now accepts multiple occurrences of `-g -g`
 * (as a drive-by, I gave `-O` the same treatment: multiple occurrences of `-O` are treated as synonymous as a single occurrence of `-O`.

Fix rust-lang#24937
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants