public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
@ 2024-05-19 19:20 Kicer86 at gmail dot com
  2024-05-19 20:33 ` [Bug c++/115159] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Kicer86 at gmail dot com @ 2024-05-19 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115159
           Summary: internal compiler error: in nothrow_spec_p, at
                    cp/except.cc:1206 when using modules and
                    QCoreApplication
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Kicer86 at gmail dot com
  Target Milestone: ---

When compiling a simple cpp file with #include <QCoreApplication> and modules
enabled gcc crashes:

FAILED: src/database/benchmarks/CMakeFiles/backends_benchmark.dir/main.cpp.o 
/usr/bin/c++ -DOS_UNIX -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SQL_LIB
-DUPDATER_ENABLED
-I/home/michal/projects/sources/broom/src/third_party/nanobench/src/include
-I/home/michal/projects/sources/broom/src
-I/home/michal/projects/sources/broom/out/gcc/src/database/backends/memory_backend
-I/home/michal/projects/sources/broom/out/gcc/src/database
-I/home/michal/projects/sources/broom/out/gcc/src/core
-I/home/michal/projects/sources/broom/src/third_party/reflect-cpp/include
-I/home/michal/projects/sources/broom/out/gcc/src/database/backends/sql_backends/sqlite_backend
-I/home/michal/projects/sources/broom/out/gcc/src/database/backends/sql_backends
-isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem
/usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtGui -isystem
/usr/include/qt6/QtSql -pipe -W -Wall -Wextra -Wdouble-promotion
-Wduplicated-branches -Wduplicated-cond -Wconversion -Wimplicit-fallthrough=5
-Wfloat-equal -Wformat=2 -Winit-self -Wlogical-op -Wpedantic -Wrestrict
-Wsequence-point -Wshadow -Wunused -Wundef -Wnull-dereference -Wold-style-cast
-Wuseless-cast -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override
-g -O0 -std=c++20 -fPIE -mno-direct-extern-access -MD -MT
src/database/benchmarks/CMakeFiles/backends_benchmark.dir/main.cpp.o -MF
src/database/benchmarks/CMakeFiles/backends_benchmark.dir/main.cpp.o.d
-fmodules-ts
-fmodule-mapper=src/database/benchmarks/CMakeFiles/backends_benchmark.dir/main.cpp.o.modmap
-MD -fdeps-format=p1689r5 -x c++ -o
src/database/benchmarks/CMakeFiles/backends_benchmark.dir/main.cpp.o -c
/home/michal/projects/sources/broom/src/database/benchmarks/main.cpp
In file included from /usr/include/c++/14.1.1/variant:43,
                 from /usr/include/qt6/QtCore/qtypeinfo.h:11,
                 from /usr/include/qt6/QtCore/qglobal.h:47,
                 from /usr/include/qt6/QtCore/qcoreapplication.h:7,
                 from /usr/include/qt6/QtCore/QCoreApplication:1,
                 from
/home/michal/projects/sources/broom/src/database/benchmarks/main.cpp:2:
/usr/include/c++/14.1.1/bits/functional_hash.h:246:53: internal compiler error:
in nothrow_spec_p, at cp/except.cc:1206
  246 |         return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
      |                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
0x217b58a internal_error(char const*, ...)
        ???:0
0x703de7 fancy_abort(char const*, int, char const*)
        ???:0
0x926cbf canonical_eh_spec(tree_node*)
        ???:0
0x936e78 build_cp_fntype_variant(tree_node*, cp_ref_qualifier, tree_node*,
bool)
        ???:0
0x834433 module_state::read_cluster(unsigned int)
        ???:0
0x834d3d module_state::load_section(unsigned int, binding_slot*)
        ???:0
0x82df3f module_state::lazy_load(unsigned int, binding_slot*)
        ???:0
0x834381 module_state::read_cluster(unsigned int)
        ???:0
0x834d3d module_state::load_section(unsigned int, binding_slot*)
        ???:0
0x82df3f module_state::lazy_load(unsigned int, binding_slot*)
        ???:0
0x836ddc lazy_load_pendings(tree_node*)
        ???:0
0x8c4504 instantiate_decl(tree_node*, bool, bool)
        ???:0
0x8ea563 instantiate_pending_templates(int)
        ???:0
0x7ccd41 c_parse_final_cleanups()
        ???:0
0x9c4df2 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues>
for instructions.


Source file:
#include <QCoreApplication>

import photoDeltaFetchingBenchmarks;

int main(int argc, char** argv)
{
    QCoreApplication app(argc, argv);

    BM_get_photo_delta();
    BM_fetch_photo_delta();
}

I have generated a preprocesed source file with -freport-bug but it is too big
to include.

Problem occurs on
$ gcc --version
gcc (GCC) 14.1.1 20240507

Arch Linux

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
@ 2024-05-19 20:33 ` pinskia at gcc dot gnu.org
  2024-05-20  6:16 ` Kicer86 at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-19 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-05-19

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The preprocessed source didn't attach, maybe it was too big. Can you compress
it and try again?
Also I think we will need the preprocessed source for the module
`photoDeltaFetchingBenchmarks` too.

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
  2024-05-19 20:33 ` [Bug c++/115159] " pinskia at gcc dot gnu.org
@ 2024-05-20  6:16 ` Kicer86 at gmail dot com
  2024-05-20  6:18 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kicer86 at gmail dot com @ 2024-05-20  6:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Michał Walenciak <Kicer86 at gmail dot com> ---
Created attachment 58248
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58248&action=edit
preprocessed project files

main.cpp compiled with -freport-bug (ccnR6WAp.out file) plus preprocessed file
with exported functions (photo_fetch_benchmarks.cpp.o.ddi.i)

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
  2024-05-19 20:33 ` [Bug c++/115159] " pinskia at gcc dot gnu.org
  2024-05-20  6:16 ` Kicer86 at gmail dot com
@ 2024-05-20  6:18 ` pinskia at gcc dot gnu.org
  2024-05-21 14:49 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-20  6:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|1                           |0
             Status|WAITING                     |UNCONFIRMED

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-05-20  6:18 ` pinskia at gcc dot gnu.org
@ 2024-05-21 14:49 ` ppalka at gcc dot gnu.org
  2024-05-22 21:45 ` cvs-commit at gcc dot gnu.org
  2024-05-22 21:47 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-05-21 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|2024-05-19 00:00:00         |2024-05-21
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, thanks for the reproducer.

Reduced:

$ cat 115159_a.H
struct QDebug;

template<class T> void f(T);

template<class T> struct QList {
  QDebug operator<(QList &other) noexcept(noexcept(f(other)));
  QDebug operator>(QList &other) noexcept(noexcept(f(other)));
};

struct QObjectData {
  QList<int> children;
};

struct QIODevice {
  QObjectData d_ptr;
};

struct QDebug {
  QDebug(QIODevice);
};

$ cat 115159_b.C
import "115159_a.H";

$ g++ -fno-module-lazy -fmodules-ts -std=c++20 115159_{a.H,b.C}
115159_b.C:1:22: internal compiler error: in nothrow_spec_p, at
cp/except.cc:1202

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-05-21 14:49 ` ppalka at gcc dot gnu.org
@ 2024-05-22 21:45 ` cvs-commit at gcc dot gnu.org
  2024-05-22 21:47 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-22 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:3c98d06a9016a0fa3a806879bd168f13b8a606f8

commit r15-779-g3c98d06a9016a0fa3a806879bd168f13b8a606f8
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed May 22 17:45:04 2024 -0400

    c++: canonicity of fn types w/ complex eh specs [PR115159]

    Here the member functions QList::g and QList::h are given the same
    function type by build_cp_fntype_variant since their noexcept-specs are
    equivalent according to cp_tree_equal.  In doing so however this means
    that the function type of QList::h refers to a function parameter from
    QList::g, which ends up confusing modules streaming.

    I'm not sure if modules can be fixed to handle this situation, but
    regardless it seems weird in principle that a function parameter can
    escape in such a way.  The analogous situation with a trailing return
    type and decltype

      auto g(QList &other) -> decltype(f(other));
      auto h(QList &other) -> decltype(f(other));

    behaves better because we don't canonicalize decltype, and so the
    function types of g and h are non-canonical and therefore not shared.

    In light of this, it seems natural to treat function types with complex
    noexcept-specs as non-canonical as well so that each such function
    declaration is given a unique function type node.  (The main benefit of
    type canonicalization is to speed up repeated type comparisons, but it
    should be rare to repeatedly compare two otherwise compatible function
    types with complex noexcept-specs.)

    To that end, this patch strengthens the ce_exact case of comp_except_specs
    to require identity instead of equivalence of the noexcept-spec so that
    build_cp_fntype_variant doesn't reuse a variant when it shouldn't.  In
    turn we need to use structural equality for types with a complex eh spec.
    This lets us get rid of the tricky handling of canonical types when
updating
    unparsed noexcept-spec variants.

            PR c++/115159

    gcc/cp/ChangeLog:

            * tree.cc (build_cp_fntype_variant): Always use structural
            equality for types with a complex exception specification.
            (fixup_deferred_exception_variants): Use structural equality
            for adjusted variants.
            * typeck.cc (comp_except_specs): Require == instead of
            cp_tree_equal for ce_exact noexcept-spec comparison.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/noexcept-2_a.H: New test.
            * g++.dg/modules/noexcept-2_b.C: New test.

    Reviewed-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/115159] internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication
  2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
                   ` (4 preceding siblings ...)
  2024-05-22 21:45 ` cvs-commit at gcc dot gnu.org
@ 2024-05-22 21:47 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-05-22 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
      Known to fail|                            |14.1.0
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
      Known to work|                            |15.0

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Should be fixed on trunk now, sadly the fix isn't suitable for backporting.

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

end of thread, other threads:[~2024-05-22 21:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-19 19:20 [Bug c++/115159] New: internal compiler error: in nothrow_spec_p, at cp/except.cc:1206 when using modules and QCoreApplication Kicer86 at gmail dot com
2024-05-19 20:33 ` [Bug c++/115159] " pinskia at gcc dot gnu.org
2024-05-20  6:16 ` Kicer86 at gmail dot com
2024-05-20  6:18 ` pinskia at gcc dot gnu.org
2024-05-21 14:49 ` ppalka at gcc dot gnu.org
2024-05-22 21:45 ` cvs-commit at gcc dot gnu.org
2024-05-22 21:47 ` ppalka 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).