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

-Zprofile broken in nightly? #50203

Closed
mssun opened this issue Apr 24, 2018 · 17 comments
Closed

-Zprofile broken in nightly? #50203

mssun opened this issue Apr 24, 2018 · 17 comments
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mssun
Copy link
Contributor

mssun commented Apr 24, 2018

I am using -Zprofile to use gcov. However, the results are corrupted.

Here are my info.

$ cargo -V
cargo 1.26.0-nightly (008c36908 2018-04-13)
$ rustc -V
rustc 1.27.0-nightly (ac3c2288f 2018-04-18)

Reproduce the issue:

$ cargo new hello_world --bin
$ cargo rustc --bins -- -Zprofile -Copt-level=1 -Clink-dead-code -Ccodegen-units=1 -Zno-landing-pads
$ ./target/debug/hello_world
./target/debug/hello_world
Hello, world!
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x66353136)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous run count: corrupt object tag (0x37633437)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x66353136)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x63626564)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous run count: corrupt object tag (0x00456238)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x38327472)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous run count: corrupt object tag (0xa3000000)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x246e6f69)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous run count: corrupt object tag (0x36245447)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous GCDA file: corrupt arc tag (0x36626331)
profiling: /hello_world/target/debug/deps/hello_world-b633c1f029999720.gcda: cannot merge previous run count: corrupt object tag (0x00004530)

It works when using older version:

$ rustup override set nightly-2017-06-28

I don't know if this issue related with kennytm/cov#18

Also: ping #42524

@mssun mssun changed the title Does -Zprofile broken in nightly? Is -Zprofile broken in nightly? Apr 24, 2018
@mssun mssun changed the title Is -Zprofile broken in nightly? -Zprofile broken in nightly? Apr 24, 2018
@pietroalbini pietroalbini added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Apr 26, 2018
@marco-c
Copy link
Contributor

marco-c commented Jun 8, 2018

It would be great if we could bisect this, to know what caused the regression.

@mssun
Copy link
Contributor Author

mssun commented Jun 8, 2018

Thanks. It still breaks on the latest nightly.

$ rustc -V
rustc 1.28.0-nightly (4a9c58c6b 2018-06-05)
$ cargo -V
cargo 1.28.0-nightly (c3b09c968 2018-05-27)

This feature is really important to get a proper code coverage profile.

@marco-c
Copy link
Contributor

marco-c commented Jun 8, 2018

I'm trying to bisect manually.
For now:
2018-01-01 is broken.
2017-12-15 is working.

@marco-c
Copy link
Contributor

marco-c commented Jun 8, 2018

2017-12-24 is working. 2017-12-25 is broken.
Here are the commits landed between those two days: https://github.com/rust-lang/rust/compare/master@%7B2017-12-24%7D...master@%7B2017-12-25%7D.

@marco-c
Copy link
Contributor

marco-c commented Jun 8, 2018

I guess we should have added parsing of gcda as part of this test: https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/profile/Makefile.

@marco-c
Copy link
Contributor

marco-c commented Jun 12, 2018

@alexcrichton is the range from #50203 (comment) correct? I guess there's a precise way to tell what commit a given Nightly build correspons to?

@kennytm
Copy link
Member

kennytm commented Jun 14, 2018

C:\> rustc +nightly-2017-12-24 -vV
rustc 1.24.0-nightly (169929308 2017-12-23)
binary: rustc
commit-hash: 16992930835ce3376a4aaed42307726e1fc78e45
commit-date: 2017-12-23
host: x86_64-pc-windows-msvc
release: 1.24.0-nightly
LLVM version: 4.0

C:\> rustc +nightly-2017-12-25 -vV
rustc 1.24.0-nightly (c284f8807 2017-12-24)
binary: rustc
commit-hash: c284f8807eb3a1d728242bb6a767b0306d6f6bd5
commit-date: 2017-12-24
host: x86_64-pc-windows-msvc
release: 1.24.0-nightly
LLVM version: 4.0

The regression happens between 1699293...c284f88

PRs in this range:

Fast PR-by-PR bisection is impossible at this point since the artifacts have been deleted.

@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

Thanks @kennytm. I've tested with 4910ed2 and it is working. So the regression is between 4910ed2 and c284f88.

@kennytm kennytm added the A-incr-comp Area: Incremental compilation label Jun 18, 2018
@kennytm
Copy link
Member

kennytm commented Jun 18, 2018

It is caused by incremental compilation.

~:45$ rustc --crate-name hello_world src/main.rs --crate-type bin --emit=link -C debuginfo=2 -Zprofile -Copt-level=1 -Clink-dead-code -Ccodegen-units=1 -Zno-landing-pads -C metadata=e6641c514587dc22 -C extra-filename=-e6641c514587dc22 --out-dir ~/hello_world/target/debug/deps 

~:46$ ./target/debug/deps/hello_world-e6641c514587dc22
Hello, world!

~:47$ rustc --crate-name hello_world src/main.rs --crate-type bin --emit=link -C debuginfo=2 -Zprofile -Copt-level=1 -Clink-dead-code -Ccodegen-units=1 -Zno-landing-pads -C metadata=e6641c514587dc22 -C extra-filename=-e6641c514587dc22 --out-dir ~/hello_world/target/debug/deps -C incremental=~/hello_world/target/debug/incremental

~:48$ ./target/debug/deps/hello_world-e6641c514587dc22
Hello, world!
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000001)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x24246437)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x24643775)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x39383038)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x32626265)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x39383038)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x62333333)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x38327472)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x34737973)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x78696e75)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x246e6f69)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x36245447)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous GCDA file: corrupt arc tag (0x38306266)
profiling: ~/hello_world/target/debug/deps/hello_world-e6641c514587dc22.gcda: cannot merge previous run count: corrupt object tag (0x00004538)

kennytm added a commit to kennytm/cov that referenced this issue Jun 18, 2018
@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

git bisect start
# bad: [c284f8807eb3a1d728242bb6a767b0306d6f6bd5] Auto merge of #46789 - Diggsey:command-env-capture, r=dtolnay
git bisect bad c284f8807eb3a1d728242bb6a767b0306d6f6bd5
# good: [16992930835ce3376a4aaed42307726e1fc78e45] Auto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakis
git bisect good 16992930835ce3376a4aaed42307726e1fc78e45
# good: [16992930835ce3376a4aaed42307726e1fc78e45] Auto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakis
git bisect good 16992930835ce3376a4aaed42307726e1fc78e45
# good: [11a24d9c3940f60e527c571680d64e80e0889abe] Auto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakis
git bisect good 11a24d9c3940f60e527c571680d64e80e0889abe
# good: [304717bd86e42bc9b0c45ea5a6068e7ed9d13f2f] Auto merge of #46894 - detrumi:fix-const-eval-trait, r=eddyb
git bisect good 304717bd86e42bc9b0c45ea5a6068e7ed9d13f2f

Almost done.

@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

325d739 is the culprit.

@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

325d739 updated Cargo from 930f9d949b384fde9b0d7b9cc590515933f194c0 to e08f310188cc0d101550c21b3d88877cfba7e5e1, here's the list of commits that landed between the two: rust-lang/cargo@930f9d9...e08f310.

@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

So I guess it's simply rust-lang/cargo#4817.

@kennytm
Copy link
Member

kennytm commented Jun 18, 2018

Well so we're back to square one 😞. Maybe inc. comp. is simply incompatible with -Zprofile.

@marco-c
Copy link
Contributor

marco-c commented Jun 18, 2018

We could disable incremental compilation when profile is enabled, like for LTO.

@marco-c
Copy link
Contributor

marco-c commented Jun 19, 2018

We could disable incremental compilation when profile is enabled, like for LTO.

I've opened #51645 to do this.

bors added a commit that referenced this issue Jul 2, 2018
…michaelwoerister

Raise an error if gcov profiling and incremental compilation are both enabled

Fixes #50203.
@wllenyj
Copy link

wllenyj commented Feb 16, 2022

The same problem reappeared in 1.60.0-nightly (09cb29c 2022-02-15)

    ubuntu: info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
    ubuntu:   nightly-x86_64-unknown-linux-gnu installed - rustc 1.60.0-nightly (09cb29c64 2022-02-15)
    ubuntu: 
    ubuntu: 
    ubuntu: Rust is installed now. Great!

...

failures:

---- x86_64::mpspec::bindgen_test_layout_mpc_cpu stdout ----
---- x86_64::mpspec::bindgen_test_layout_mpc_cpu stderr ----
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000001)
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000001)
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x75747375)
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x3638782d)
profiling: /vagrant/target/debug/deps/db_boot-f38d7d4bfa105ed8.gcda: cannot merge previous GCDA file: corrupt arc tag (0x696c2f75)

See https://github.com/wllenyj/dragonball-sandbox/runs/5212083346 for details.

@workingjubilee workingjubilee added the A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants