public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wentaoz5 at illinois dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/115047] New: Inconsistent MC/DC reported by GCC and LLVM Date: Sun, 12 May 2024 07:44:40 +0000 [thread overview] Message-ID: <bug-115047-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115047 Bug ID: 115047 Summary: Inconsistent MC/DC reported by GCC and LLVM Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: wentaoz5 at illinois dot edu Target Milestone: --- How to reproduce: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/gcc-latest/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/opt/gcc-latest --enable-languages=c,c++ --enable-libstdcxx-debug --enable-libstdcxx-backtrace --disable-bootstrap --disable-multilib --disable-libvtv --with-system-zlib --without-isl --enable-multiarch Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.1 20240421 (experimental) (GCC) $ clang -v Ubuntu clang version 18.1.3 (++20240322073153+ef6d1ec07c69-1~exp1~20240322193300.86) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-18/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 Candidate multilib: .;@m64 Selected multilib: .;@m64 $ cat > test.c << EOF void f(int a, int b, int c) { a && b || c; } int main(void) { f(0,0,1); f(1,0,0); return 0; } EOF $ gcc --coverage -fcondition-coverage test.c -o test $ ./test $ gcov --conditions test.c $ cat test.c.gcov File 'test.c' Lines executed:100.00% of 5 Condition outcomes covered:50.00% of 6 Creating 'test.c.gcov' Lines executed:100.00% of 5 -: 0:Source:test.c -: 0:Graph:test.gcno -: 0:Data:test.gcda -: 0:Runs:1 2: 1:void f(int a, int b, int c) { a && b || c; } condition outcomes covered 3/6 condition 0 not covered (true false) condition 1 not covered (true) 1: 2:int main(void) { 1: 3: f(0,0,1); 1: 4: f(1,0,0); 1: 5: return 0; -: 6:} $ clang -Wno-unused-value -fprofile-instr-generate -fcoverage-mapping -fcoverage-mcdc test.c -o test $ ./test $ llvm-profdata merge default.profraw -o default.profdata $ llvm-cov show --show-mcdc -instr-profile default.profdata test 1| 2|void f(int a, int b, int c) { a && b || c; } ------------------ |---> MC/DC Decision Region (1:31) to (1:42) | | Number of Conditions: 3 | Condition C1 --> (1:31) | Condition C2 --> (1:36) | Condition C3 --> (1:41) | | Executed MC/DC Test Vectors: | | C1, C2, C3 Result | 1 { T, F, F = F } | 2 { F, -, T = T } | | C1-Pair: not covered | C2-Pair: not covered | C3-Pair: not covered | MC/DC Coverage for Decision: 0.00% | ------------------ 2| 1|int main(void) { 3| 1| f(0,0,1); 4| 1| f(1,0,0); 5| 1| return 0; 6| 1|} In this example, gcov believes condition "c" is covered but LLVM reports that none of the conditions is covered.
next reply other threads:[~2024-05-12 7:44 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-12 7:44 wentaoz5 at illinois dot edu [this message] 2024-05-13 18:51 ` [Bug gcov-profile/115047] " j at lambda dot is 2024-05-13 19:10 ` j at lambda dot is 2024-06-05 5:29 ` wentaoz5 at illinois dot edu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-115047-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).