Skip to content

-Zprofile broken in nightly? #50203

Description

@mssun

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

Activity

  1. changed the title [-]Does -Zprofile broken in nightly?[/-] [+]Is -Zprofile broken in nightly?[/+] on Apr 24, 2018
  2. changed the title [-]Is -Zprofile broken in nightly?[/-] [+]-Zprofile broken in nightly?[/+] on Apr 24, 2018
  3. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Apr 26, 2018
  4. marco-c commented on Jun 8, 2018

    @marco-c
    Contributor

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

  5. mssun commented on Jun 8, 2018

    @mssun
    ContributorAuthor

    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.

  6. marco-c commented on Jun 8, 2018

    @marco-c
    Contributor

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

  7. marco-c commented on Jun 8, 2018

    @marco-c
    Contributor

    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.

  8. marco-c commented on Jun 8, 2018

    @marco-c
    Contributor

    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.

  9. marco-c commented on Jun 12, 2018

    @marco-c
    Contributor

    @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?

  10. kennytm commented on Jun 14, 2018

    @kennytm
    Member
    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.

  11. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor

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

  12. kennytm commented on Jun 18, 2018

    @kennytm
    Member

    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)
    
  13. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor
    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.

  14. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor

    325d739 is the culprit.

  15. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor

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

  16. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor

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

  17. kennytm commented on Jun 18, 2018

    @kennytm
    Member

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

  18. marco-c commented on Jun 18, 2018

    @marco-c
    Contributor

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

  19. marco-c commented on Jun 19, 2018

    @marco-c
    Contributor

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

    I've opened #51645 to do this.

  20. added a commit that references this issue on Jul 2, 2018
    e75e782
  21. wllenyj commented on Feb 16, 2022

    @wllenyj
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions