public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115165] New: ICE on -ftime-report with module and c++2b
@ 2024-05-20 17:15 porten at kde dot org
  2024-05-20 17:17 ` [Bug c++/115165] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: porten at kde dot org @ 2024-05-20 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115165
           Summary: ICE on -ftime-report with module and c++2b
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: porten at kde dot org
  Target Milestone: ---

Purely by accident, I ran into an ICE when using -ftime-report on a file
including a system header with a .gcm file of that header present. The scenario
appeared after an attempt to improve compilation speed.

timevar.cc line 490 performs gcc_assert (!tv->standalone).

Note 1: A combination of #include <x> with x.gcm present may be unsupported.

Note 2: The error goes away when compiling with c++2a or c++20 rather than
c++2b.

$ cat main.cpp
#include <iostream>
int main(int, char **) { std::cout; }

$ g++ -fmodules-ts -std=c++2b -x c++-system-header iostream

$ g++ -ftime-report -fmodules-ts -std=c++2b main.cpp
main.cpp: In destructor ‘std::__codecvt_abstract_base<_InternT, _ExternT,
_StateT>::~__codecvt_abstract_base() [with _InternT = char16_t; _ExternT =
char; _StateT = __mbstate_t]’:
main.cpp:2:31: internal compiler error: in start, at timevar.cc:490
    2 | int main(int, char **) { std::cout; }
      |                               ^~~~
0x74294d timer::start(timevar_id_t)
        /home/user/git/gcc/gcc/timevar.cc:490
0x74294d timer::start(timevar_id_t)
        /home/user/git/gcc/gcc/timevar.cc:481
0x74294d timevar_start(timevar_id_t)
        /home/user/git/gcc/gcc/timevar.cc:475
0x87b7ec lazy_load_pendings(tree_node*)
        /home/user/git/gcc/gcc/cp/module.cc:19470
0x881c48 maybe_lazily_declare
        /home/user/git/gcc/gcc/cp/name-lookup.cc:2002
0x881c48 get_class_binding(tree_node*, tree_node*, bool)
        /home/user/git/gcc/gcc/cp/name-lookup.cc:2038
0x9342fd lookup_field_r
        /home/user/git/gcc/gcc/cp/search.cc:1061
0x934c18 dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node*
(*)(tree_node*, void*), void*)
        /home/user/git/gcc/gcc/cp/search.cc:1507
0x934c18 lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
        /home/user/git/gcc/gcc/cp/search.cc:1216
0x9350d0 lookup_fnfields(tree_node*, tree_node*, int, int)
        /home/user/git/gcc/gcc/cp/search.cc:1426
0x773277 build_op_delete_call(tree_code, tree_node*, tree_node*, bool,
tree_node*, tree_node*, int)
        /home/user/git/gcc/gcc/cp/call.cc:7864
0x892372 build_delete_destructor_body
        /home/user/git/gcc/gcc/cp/optimize.cc:140
0x893738 maybe_clone_body(tree_node*)
        /home/user/git/gcc/gcc/cp/optimize.cc:610
0x85f01f post_load_processing
        /home/user/git/gcc/gcc/cp/module.cc:17758
0x877793 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
        /home/user/git/gcc/gcc/cp/module.cc:19424
0x889b64 name_lookup::search_namespace_only(tree_node*)
        /home/user/git/gcc/gcc/cp/name-lookup.cc:920
0x889ca4 name_lookup::search_namespace(tree_node*)
        /home/user/git/gcc/gcc/cp/name-lookup.cc:1006
0x889f8f name_lookup::search_namespace(tree_node*)
        /home/user/git/gcc/gcc/cp/name-lookup.cc:1001
0x889f8f name_lookup::search_qualified(tree_node*, bool)
        /home/user/git/gcc/gcc/cp/name-lookup.cc:1067
0x88d161 qualified_namespace_lookup
        /home/user/git/gcc/gcc/cp/name-lookup.cc:7278
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

GCC was built with today's state of the releases/gcc-14 branch. 

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/gcc-14/libexec/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/porten/git/gcc/configure --disable-multilib
--prefix=/opt/gcc-14 --enable-languages=c,c++ : (reconfigured)
/home/porten/git/gcc/configure --disable-multilib --prefix=/opt/gcc-14
--enable-languages=c,c++ : (reconfigured) /home/porten/git/gcc/configure
--disable-multilib --prefix=/opt/gcc-14 --enable-languages=c,c++,lto
--no-create --no-recursion
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.1.1 20240520 (GCC)

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

* [Bug c++/115165] ICE on -ftime-report with module and c++2b
  2024-05-20 17:15 [Bug c++/115165] New: ICE on -ftime-report with module and c++2b porten at kde dot org
@ 2024-05-20 17:17 ` mpolacek at gcc dot gnu.org
  2024-07-18  3:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-05-20 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-05-20
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/115165] ICE on -ftime-report with module and c++2b
  2024-05-20 17:15 [Bug c++/115165] New: ICE on -ftime-report with module and c++2b porten at kde dot org
  2024-05-20 17:17 ` [Bug c++/115165] " mpolacek at gcc dot gnu.org
@ 2024-07-18  3:07 ` cvs-commit at gcc dot gnu.org
  2024-07-18  3:08 ` cvs-commit at gcc dot gnu.org
  2024-07-18  3:10 ` nshead at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-07-18  3:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

https://gcc.gnu.org/g:b7b2434cc7e712dc5055bde02c441393ae881f06

commit r15-2121-gb7b2434cc7e712dc5055bde02c441393ae881f06
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Sun Jul 7 23:19:52 2024 +1000

    c++/modules: Conditionally start timer during lazy load [PR115165]

    While lazy loading, instantiation of pendings can sometimes recursively
    perform name lookup and begin further lazy loading.  When using the
    '-ftime-report' functionality this causes ICEs as we could start an
    already-running timer for the importing.

    This patch fixes the issue by using the 'timevar_cond*' API instead to
    support such recursive calls.

            PR c++/115165

    gcc/cp/ChangeLog:

            * module.cc (lazy_load_binding): Use 'timevar_cond*' APIs.
            (lazy_load_pendings): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/timevar-1_a.H: New test.
            * g++.dg/modules/timevar-1_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

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

* [Bug c++/115165] ICE on -ftime-report with module and c++2b
  2024-05-20 17:15 [Bug c++/115165] New: ICE on -ftime-report with module and c++2b porten at kde dot org
  2024-05-20 17:17 ` [Bug c++/115165] " mpolacek at gcc dot gnu.org
  2024-07-18  3:07 ` cvs-commit at gcc dot gnu.org
@ 2024-07-18  3:08 ` cvs-commit at gcc dot gnu.org
  2024-07-18  3:10 ` nshead at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-07-18  3:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Nathaniel Shead
<nshead@gcc.gnu.org>:

https://gcc.gnu.org/g:f0c3a1c16af234b55f48cf1cfe299417f93f163c

commit r14-10453-gf0c3a1c16af234b55f48cf1cfe299417f93f163c
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Sun Jul 7 23:19:52 2024 +1000

    c++/modules: Conditionally start timer during lazy load [PR115165]

    While lazy loading, instantiation of pendings can sometimes recursively
    perform name lookup and begin further lazy loading.  When using the
    '-ftime-report' functionality this causes ICEs as we could start an
    already-running timer for the importing.

    This patch fixes the issue by using the 'timevar_cond*' API instead to
    support such recursive calls.

            PR c++/115165

    gcc/cp/ChangeLog:

            * module.cc (lazy_load_binding): Use 'timevar_cond*' APIs.
            (lazy_load_pendings): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/timevar-1_a.H: New test.
            * g++.dg/modules/timevar-1_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

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

* [Bug c++/115165] ICE on -ftime-report with module and c++2b
  2024-05-20 17:15 [Bug c++/115165] New: ICE on -ftime-report with module and c++2b porten at kde dot org
                   ` (2 preceding siblings ...)
  2024-07-18  3:08 ` cvs-commit at gcc dot gnu.org
@ 2024-07-18  3:10 ` nshead at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-07-18  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nshead at gcc dot gnu.org
             Status|NEW                         |RESOLVED
           Assignee|unassigned at gcc dot gnu.org      |nshead at gcc dot gnu.org
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.2

--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 14.2 / trunk.

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

end of thread, other threads:[~2024-07-18  3:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-20 17:15 [Bug c++/115165] New: ICE on -ftime-report with module and c++2b porten at kde dot org
2024-05-20 17:17 ` [Bug c++/115165] " mpolacek at gcc dot gnu.org
2024-07-18  3:07 ` cvs-commit at gcc dot gnu.org
2024-07-18  3:08 ` cvs-commit at gcc dot gnu.org
2024-07-18  3:10 ` nshead 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).