public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "njuwy at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/99443] New: [GCOV] No coverage with "Aborted(core dumped)"
Date: Sun, 07 Mar 2021 08:34:14 +0000	[thread overview]
Message-ID: <bug-99443-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99443

            Bug ID: 99443
           Summary: [GCOV] No coverage with "Aborted(core dumped)"
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: njuwy at smail dot nju.edu.cn
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++
-disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC) 

$ cat test.c
#include <x86intrin.h>
#include <stdio.h>

extern void abort(void);

#ifdef __x86_64__
#define EFLAGS_TYPE unsigned long long int
#else
#define EFLAGS_TYPE unsigned int
#endif

int main() {
  printf("1\n");
  EFLAGS_TYPE flags = 0xD7; /* 111010111b  */
  __writeeflags(flags);
  flags = __readeflags();
  printf("2\n");
  if ((flags & 0xFF) != 0xD7)
    abort();
  printf("3\n");
#ifdef DEBUG
  printf("PASSED\n");
#endif
}

$ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov
1
2
Aborted (core dumped)
test.gcda:cannot open data file, assuming not executed
File 'test.c'
Lines executed:0.00% of 8
Creating 'test.c.gcov'

File '/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/ia32intrin.h'
Lines executed:0.00% of 3
Creating 'ia32intrin.h.gcov'

        -:    0:Source:test.c
        -:    0:Graph:test.gcno
        -:    0:Data:-
        -:    0:Runs:0
        -:    1:#include <x86intrin.h>
        -:    2:#include <stdio.h>
        -:    3:
        -:    4:extern void abort(void);
        -:    5:
        -:    6:#ifdef __x86_64__
        -:    7:#define EFLAGS_TYPE unsigned long long int
        -:    8:#else
        -:    9:#define EFLAGS_TYPE unsigned int
        -:   10:#endif
        -:   11:
    #####:   12:int main() {
    #####:   13:  printf("1\n");
    #####:   14:  EFLAGS_TYPE flags = 0xD7; /* 111010111b  */
        -:   15:  __writeeflags(flags);
    #####:   16:  flags = __readeflags();
    #####:   17:  printf("2\n");
    #####:   18:  if ((flags & 0xFF) != 0xD7)
    #####:   19:    abort();
    #####:   20:  printf("3\n");
        -:   21:#ifdef DEBUG
        -:   22:  printf("PASSED\n");
        -:   23:#endif
        -:   24:}

We can see that line #13,#14 were executed,which means that main function
executed too. However, no coverage generated.

             reply	other threads:[~2021-03-07  8:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07  8:34 njuwy at smail dot nju.edu.cn [this message]
2021-03-07  9:09 ` [Bug gcov-profile/99443] " pinskia at gcc dot gnu.org
2021-03-07  9:09 ` pinskia at gcc dot gnu.org
2021-03-07 12:51 ` njuwy at smail dot nju.edu.cn
2021-03-07 20:58 ` pinskia at gcc dot gnu.org
2021-03-08  9:11 ` marxin at gcc dot gnu.org

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-99443-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: link
Be 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).