public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage
@ 2020-06-23 19:11 olebole at debian dot org
  2020-06-23 21:07 ` [Bug gcov-profile/95847] " dominiq at lps dot ens.fr
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: olebole at debian dot org @ 2020-06-23 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95847
           Summary: Internal error when processing pFUnit generated files
                    with --coverage
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olebole at debian dot org
  Target Milestone: ---

Created attachment 48776
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48776&action=edit
Source file that reproduces the bug

With gcc 9 and 10, compiling the attached file with coverage info raises an
internal error:

$ gfortran-10 -c --coverage funit-bug.f90 
during IPA pass: profile
funit-bug.f90:8:0:

    8 |    use foo
      | 
internal compiler error: in coverage_begin_function, at coverage.c:656
0x7f6c0275ae0a __libc_start_main
        ../csu/libc-start.c:308
[…]
$ gfortran-10 --version
GNU Fortran (Debian 10.1.0-3) 10.1.0
[…]
$ gfortran-9 --version
GNU Fortran (Debian 9.3.0-14) 9.3.0

This does not happen with gfortran-8, so it is a regression:

$ gfortran-8 -c --coverage funit-bug.f90
$ gfortran-8 --version
GNU Fortran (Debian 8.4.0-4) 8.4.0

System is Debian 11 testing.
The attached file is derived from a pFUnit generated file where this was
originally observed <https://github.com/Goddard-Fortran-Ecosystem/pFUnit>.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug gcov-profile/95847] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
@ 2020-06-23 21:07 ` dominiq at lps dot ens.fr
  2020-06-24  6:53 ` [Bug gcov-profile/95847] [9/10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-06-23 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-06-23
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The ICE is present in a significant number of tests in the test suite
(run make -k -j16 check-gfortran RUNTESTFLAGS="--target_board=unix
--tool_opts='--coverage'" in the gcc directory).

The change occurred between 2018-11-17 (OK) and 2018-11-24 (ICE).

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug gcov-profile/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
  2020-06-23 21:07 ` [Bug gcov-profile/95847] " dominiq at lps dot ens.fr
@ 2020-06-24  6:53 ` rguenth at gcc dot gnu.org
  2020-11-03 16:47 ` johannes.ziegenbalg at mailbox dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-24  6:53 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
            Summary|Internal error when         |[9/10/11 Regression]
                   |processing pFUnit generated |Internal error when
                   |files with --coverage       |processing pFUnit generated
                   |                            |files with --coverage
           Keywords|                            |ice-on-valid-code

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug gcov-profile/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
  2020-06-23 21:07 ` [Bug gcov-profile/95847] " dominiq at lps dot ens.fr
  2020-06-24  6:53 ` [Bug gcov-profile/95847] [9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-11-03 16:47 ` johannes.ziegenbalg at mailbox dot org
  2020-11-03 16:48 ` johannes.ziegenbalg at mailbox dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: johannes.ziegenbalg at mailbox dot org @ 2020-11-03 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

johannes.ziegenbalg at mailbox dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johannes.ziegenbalg@mailbox
                   |                            |.org

--- Comment #2 from johannes.ziegenbalg at mailbox dot org ---
I get the same bug with GCC 10.2.0 in one of my c++ test-cases.
I also tested GCC 11 (GNU Fortran (GCC) 11.0.0 20201029) with the attached file
and got the same result.

After a little digging I found out that the expanded region for 'sbr' starts at
line 8 (`use foo`) and ends at line 4 (`end subroutine sbr`).

But I have no idea why `expand_location` returns line 8.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug gcov-profile/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (2 preceding siblings ...)
  2020-11-03 16:47 ` johannes.ziegenbalg at mailbox dot org
@ 2020-11-03 16:48 ` johannes.ziegenbalg at mailbox dot org
  2020-11-03 18:06 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: johannes.ziegenbalg at mailbox dot org @ 2020-11-03 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from johannes.ziegenbalg at mailbox dot org ---
I get the same bug with GCC 10.2.0 in one of my c++ test-cases.
I also tested GCC 11 (GNU Fortran (GCC) 11.0.0 20201029) with the attached file
and got the same result.

After a little digging I found out that the expanded region for 'sbr' starts at
line 8 (`use foo`) and ends at line 4 (`end subroutine sbr`).

But I have no idea why `expand_location` returns line 8.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug gcov-profile/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (3 preceding siblings ...)
  2020-11-03 16:48 ` johannes.ziegenbalg at mailbox dot org
@ 2020-11-03 18:06 ` marxin at gcc dot gnu.org
  2020-11-05 17:08 ` [Bug fortran/95847] " marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-03 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Thanks for the report. Started with r9-4216-g390e529e2b98983d and yes it's
about a function ending sooner than it starts.
I'll take a look.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (4 preceding siblings ...)
  2020-11-03 18:06 ` marxin at gcc dot gnu.org
@ 2020-11-05 17:08 ` marxin at gcc dot gnu.org
  2020-11-05 19:51 ` kargl at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-05 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gcov-profile                |fortran
             Status|ASSIGNED                    |NEW
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot gnu.org
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |kargl at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
I can only confirm it's a Fortran issue.
Can please anybody from Fortran folks take a look?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (5 preceding siblings ...)
  2020-11-05 17:08 ` [Bug fortran/95847] " marxin at gcc dot gnu.org
@ 2020-11-05 19:51 ` kargl at gcc dot gnu.org
  2020-11-05 22:29 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-11-05 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Martin Liška from comment #5)
> I can only confirm it's a Fortran issue.
> Can please anybody from Fortran folks take a look?

First, the caveat, the Fortran code in the attached
example is invalid so a compiler can to do whatever
it wants, including dying with an ICE.

Split the example code into a file with only the 
module (say, d.f90) and a file with only the
function foo_suite (say, e.f90).  I get

% gfcx -c --coverage d.f90
% gfcx -c --coverage e.f90

with no ICE.  It seems that the strengthen assumption in
the git commit gets confused on where function information
comes from.

Just a SWAG.  Likely, gfortran reads the newly created
'foo.mod' to get information about the subroutine sbr,
so gfortran simply records the location where it obtains
the information about sbr.  That then means the location
for sbr is set to the line 'use foo'.  Why --coverage
finds the `end subroutine` at line 4 then becomes a
mystery.

Uncompressing the module shows that no location information
is stored in a module.

% cat foo.mod | gunzip
GFORTRAN module version '15' created from d.f90
(() () () () () () () () () () () () () () () () () () () () () () () ()
() () ())
()
()
()
()
()
(2 'foo' 'foo' '' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN UNKNOWN
0 0) () (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0)
3 'sbr' 'foo' '' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC DECL UNKNOWN 0
0 SUBROUTINE IMPLICIT_PURE) () (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0
() () () 0 0)
)
('foo' 0 2 'sbr' 0 3)

So, it seems the strengthened assumption isn't so strong.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (6 preceding siblings ...)
  2020-11-05 19:51 ` kargl at gcc dot gnu.org
@ 2020-11-05 22:29 ` burnus at gcc dot gnu.org
  2020-11-10  9:31 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-11-05 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch:  https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558214.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (7 preceding siblings ...)
  2020-11-05 22:29 ` burnus at gcc dot gnu.org
@ 2020-11-10  9:31 ` cvs-commit at gcc dot gnu.org
  2020-11-12 13:21 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-10  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:2d59593105d3b1e38e49f96b74fd81e4e5038c7f

commit r11-4866-g2d59593105d3b1e38e49f96b74fd81e4e5038c7f
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Nov 10 10:31:33 2020 +0100

    Fortran: Fix function decl's location [PR95847]

    gcc/fortran/ChangeLog:

            PR fortran/95847
            * trans-decl.c (gfc_get_symbol_decl): Do not (re)set the location
            of an external procedure.
            (build_entry_thunks, generate_coarray_init, create_main_function,
            gfc_generate_function_code): Use fndecl's location in BIND_EXPR.

    gcc/testsuite/ChangeLog:

            PR fortran/95847
            * gfortran.dg/coverage.f90: New test.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (8 preceding siblings ...)
  2020-11-10  9:31 ` cvs-commit at gcc dot gnu.org
@ 2020-11-12 13:21 ` burnus at gcc dot gnu.org
  2020-11-12 14:42 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-11-12 13:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to johannes.ziegenbalg from comment #2)
> I get the same bug with GCC 10.2.0 in one of my c++ test-cases.

Johannes: Can you fill a bugreport for the C++ test case? This PR is only about
Fortran – and the fix is for the Fortran front end, only.

Ole: Thanks for the report!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (9 preceding siblings ...)
  2020-11-12 13:21 ` burnus at gcc dot gnu.org
@ 2020-11-12 14:42 ` cvs-commit at gcc dot gnu.org
  2020-11-12 15:41 ` cvs-commit at gcc dot gnu.org
  2020-11-12 15:43 ` burnus at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-12 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:17563c1153d36440936ea0948ac689f84b2cf666

commit r10-9017-g17563c1153d36440936ea0948ac689f84b2cf666
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Nov 10 10:31:33 2020 +0100

    Fortran: Fix function decl's location [PR95847]

    gcc/fortran/ChangeLog:

            PR fortran/95847
            * trans-decl.c (gfc_get_symbol_decl): Do not (re)set the location
            of an external procedure.
            (build_entry_thunks, generate_coarray_init, create_main_function,
            gfc_generate_function_code): Use fndecl's location in BIND_EXPR.

    gcc/testsuite/ChangeLog:

            PR fortran/95847
            * gfortran.dg/coverage.f90: New test.

    (cherry picked from commit 2d59593105d3b1e38e49f96b74fd81e4e5038c7f)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (10 preceding siblings ...)
  2020-11-12 14:42 ` cvs-commit at gcc dot gnu.org
@ 2020-11-12 15:41 ` cvs-commit at gcc dot gnu.org
  2020-11-12 15:43 ` burnus at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-12 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:547d07637bf09d74543f688454ce53a4c5eecd47

commit r9-9041-g547d07637bf09d74543f688454ce53a4c5eecd47
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Nov 12 16:39:58 2020 +0100

    Fortran: Fix function decl's location [PR95847]

    gcc/fortran/ChangeLog:

            PR fortran/95847
            * trans-decl.c (gfc_get_symbol_decl): Do not (re)set the location
            of an external procedure.
            (build_entry_thunks, generate_coarray_init, create_main_function,
            gfc_generate_function_code): Use fndecl's location in BIND_EXPR.

    gcc/testsuite/ChangeLog:

            PR fortran/95847
            * gfortran.dg/coverage.f90: New test.

    (cherry picked from commit 2d59593105d3b1e38e49f96b74fd81e4e5038c7f)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/95847] [9/10/11 Regression] Internal error when processing pFUnit generated files with --coverage
  2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
                   ` (11 preceding siblings ...)
  2020-11-12 15:41 ` cvs-commit at gcc dot gnu.org
@ 2020-11-12 15:43 ` burnus at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-11-12 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on the GCC 11 (mainline), GCC 10 and GCC 9.

Thanks again for the report.

@johannes: As mentioned earlier today – please fill a --coverage bug report for
your C++ testcase, if it still occurs. (This PR only fixed the Fortran issue.)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-11-12 15:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 19:11 [Bug fortran/95847] New: Internal error when processing pFUnit generated files with --coverage olebole at debian dot org
2020-06-23 21:07 ` [Bug gcov-profile/95847] " dominiq at lps dot ens.fr
2020-06-24  6:53 ` [Bug gcov-profile/95847] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2020-11-03 16:47 ` johannes.ziegenbalg at mailbox dot org
2020-11-03 16:48 ` johannes.ziegenbalg at mailbox dot org
2020-11-03 18:06 ` marxin at gcc dot gnu.org
2020-11-05 17:08 ` [Bug fortran/95847] " marxin at gcc dot gnu.org
2020-11-05 19:51 ` kargl at gcc dot gnu.org
2020-11-05 22:29 ` burnus at gcc dot gnu.org
2020-11-10  9:31 ` cvs-commit at gcc dot gnu.org
2020-11-12 13:21 ` burnus at gcc dot gnu.org
2020-11-12 14:42 ` cvs-commit at gcc dot gnu.org
2020-11-12 15:41 ` cvs-commit at gcc dot gnu.org
2020-11-12 15:43 ` burnus at gcc dot gnu.org

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).