Package: g++-16
Version: 16-20260322-1
Severity: normal

Dear Maintainer,

A colleague (in Bcc to preserve their email address from spam
from scrapers of the BTS) identified an internal compiler error
affecting import of <memory> with modules support.  The error
does not appear with g++-15.  They suspect commit 10b8379
"[PATCH] libstdc++: Add smart ptr owner_equals and owner_hash"
to have revealed the problem, but they admit it may have simply
raised a pre-existing bug that remained dormant.

Symptoms look like:

        $ make
        g++-16 -std=gnu++26 -fmodules   -c -o qt.o qt.cpp
        g++-16 -std=gnu++26 -fmodules   -c -o failed_mod.o failed_mod.cpp
        In file included from failed_mod.cpp:3:
        minimal.h:56:13: internal compiler error: in register_duplicate, at 
cp/module.cc:13054
           56 |     return {};
              |             ^
        0x322e8ff internal_error(char const*, ...)
                ../../src/gcc/diagnostic-global-context.cc:787
        0xf9e0cf fancy_abort(char const*, int, char const*)
                ../../src/gcc/diagnostics/context.cc:1813
        0x114a416 register_duplicate
                ../../src/gcc/cp/module.cc:13054
        0x11547a8 decl_value
                ../../src/gcc/cp/module.cc:8819
        0x114a714 tree_node
                ../../src/gcc/cp/module.cc:10437
        0x11536e6 module_state::read_cluster(unsigned int)
                ../../src/gcc/cp/module.cc:17682
        0x11541cf module_state::load_section(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:21516
        0x1154286 module_state::lazy_load(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:22539
        0x114c245 tree_node
                ../../src/gcc/cp/module.cc:11045
        0x115333b module_state::read_cluster(unsigned int)
                ../../src/gcc/cp/module.cc:17519
        0x11541cf module_state::load_section(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:21516
        0x1154286 module_state::lazy_load(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:22539
        0x114c245 tree_node
                ../../src/gcc/cp/module.cc:11045
        0x115333b module_state::read_cluster(unsigned int)
                ../../src/gcc/cp/module.cc:17519
        0x11541cf module_state::load_section(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:21516
        0x1154286 module_state::lazy_load(unsigned int, binding_slot*)
                ../../src/gcc/cp/module.cc:22539
        0x11585fa lazy_load_pendings(tree_node*, tree_node*)
                ../../src/gcc/cp/module.cc:22640
        0x125e987 instantiate_decl(tree_node*, bool, bool)
                ../../src/gcc/cp/pt.cc:28601
        0x126923b instantiate_pending_templates(int)
                ../../src/gcc/cp/pt.cc:28896
        0x10bbc8c c_parse_final_cleanups()
                ../../src/gcc/cp/decl2.cc:5887
        /usr/libexec/gcc/x86_64-linux-gnu/16/cc1plus -quiet -imultiarch 
x86_64-linux-gnu -D_GNU_SOURCE failed_mod.cpp -quiet -dumpbase failed_mod.cpp 
-dumpbase-ext .cpp -mtune=generic -march=x86-64 -std=gnu++26 -fmodules 
-fasynchronous-unwind-tables -o /tmp/ccXRarOv.s
        Please submit a full bug report, with preprocessed source (by using 
-freport-bug).
        Please include the complete backtrace with any bug report.
        See <file:///usr/share/doc/gcc-16/README.Bugs> for instructions.
        make: *** [<builtin>: failed_mod.o] Error 1

I have attached the reproducer files to the bug report.  In its
current state, the reproducer depends on:

  * g++-16
  * qt6-base-dev

but I guess there may be options to further reduce the scope.

Have a nice day,  :)
Étienne.


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.19.11+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages g++-16 depends on:
pn  g++-16-x86-64-linux-gnu  <none>
pn  gcc-16                   <none>
ii  gcc-16-base              16-20260322-1

g++-16 recommends no packages.

Versions of packages g++-16 suggests:
pn  g++-16-multilib  <none>
pn  gcc-16-doc       <none>

-- 
  .''`.  Étienne Mollier <[email protected]>
 : :' :  pgp: 8f91 b227 c7d6 f2b1 948c  8236 793c f67e 8f0d 11da
 `. `'   sent from /dev/pts/0, please excuse my verbosity
   `-    on air: Saga - Chase The Wind
module;

#include "minimal.h"

export module failed_mod;

import qt;
CXX = g++-16
CXXFLAGS = -std=gnu++26 -fmodules

all: failed_mod.o
.PHONY: all

failed_mod.o: qt.o

clean:
        rm -vf *.o *.i
        rm -rvf gcm.cache
.PHONY: clean
#ifndef QOBJECT_H
#define QOBJECT_H

#include <memory>

template<typename T>
struct QTypeInfo
{
    static constexpr bool isIntegral = true;
};

template<typename T>
struct QBasicAtomicInteger
{
    static_assert(QTypeInfo<T>::isIntegral, "template parameter is not an integral type");
};

class QObject;

struct QMetaObject
{
    const QObject* cast(const QObject* obj) const;
};

struct QByteArray
{
    QBasicAtomicInteger<int> at;
};

namespace std {
template<>
struct hash<QByteArray>
{};
}        // namespace std

template<typename Enum>
struct QFlags
{
    QFlags() {}
};

struct QMetaType
{
    enum class TypeFlag
    {
    };

    typedef QFlags<TypeFlag> TypeFlags;

    static int registerType(const QMetaObject* metaObject);
};

inline QFlags<int>
operator|(QMetaType::TypeFlag /*f1*/, QMetaType::TypeFlag /*f2*/) noexcept
{
    return {};
}

template<typename T>
struct CapabilitiesImpl;

struct QSequentialIterableImpl
{
    template<class T>
    QSequentialIterableImpl()
    {
        CapabilitiesImpl<T>::IteratorCapabilities | (1 << 4);
    }
};

template<>
struct QTypeInfo<QSequentialIterableImpl>
{};

class QObject
{
    static bool disconnect(const QObject* sender, const char* signal, const QObject* receiver, const char* member);

    bool disconnect(const char* signal, const QObject* receiver, const char* member) const;

    std::unique_ptr<int> d_ptr;
};

#endif // QOBJECT_H
module;

#include "minimal.h"

export module qt;
export using QObject = ::QObject;

extern "C++" int
main()
{
}

Attachment: signature.asc
Description: PGP signature

Reply via email to