public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100689] New: internal compiler error: Segmentation fault when using modules and -g
@ 2021-05-20  2:52 ma30002000 at yahoo dot de
  2024-02-11 14:11 ` [Bug c++/100689] [modules] " nshead at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ma30002000 at yahoo dot de @ 2021-05-20  2:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100689
           Summary: internal compiler error: Segmentation fault when using
                    modules and -g
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ma30002000 at yahoo dot de
  Target Milestone: ---

When compile file files exp.cpp and imp.cpp with the following contents:
------------ exp.cpp ----------
module;

#include <string>

export module mod;

export std::string F() { return "test"; }
-------------------------------
------------ imp.cpp ----------
#include <span>
#include <string>
#include <cstdint>

import mod;

constexpr void
ToHexInt(uint8_t value, char& dst) {
    if (value <= 9)
        dst = static_cast<char>('0' + value);
    if (value >= 0xa && value <= 0xf)
        dst = static_cast<char>('a' + (value - 0x0a));
}

template <class DestT = std::string>
inline DestT
ToHexString(const std::span<const uint8_t>& value) {
    DestT output;
    output.resize(value.size() * 2);
    uint8_t i;
    ToHexInt(i, output[0]);
    return output;
}

int main() {
    uint8_t a[2];
    ToHexString(a);
}
-------------------------------
with the following compiler command lines:
/usr/bin/g++-11      -g  -fmodules-ts  -std=gnu++2a -o exp.cpp.o -c exp.cpp
/usr/bin/g++-11      -g  -fmodules-ts  -std=gnu++2a -o imp.cpp.o -c imp.cpp

I get the following error on compilation of imp.cpp:
-------------------------------
In file included from /usr/include/c++/11/string:38,
                 from exp.cpp:3,
of module mod, imported at imp.cpp:5:
/usr/include/c++/11/bits/basic_string.h:1045:9: internal compiler error:
Segmentation fault
 1045 |         __glibcxx_assert(__pos <= size());
      |         ^~~~~~~~~~~~~~~~
0xe30681 internal_error(char const*, ...)
        ???:0
0x9d6c83 module_state::mangle(bool)
        ???:0
0xf628a7 mangle_decl(tree_node*)
        ???:0
0x1487939 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
-------------------------------
If I do not specify "-g" the compilation concludes successfully.

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

* [Bug c++/100689] [modules] internal compiler error: Segmentation fault when using modules and -g
  2021-05-20  2:52 [Bug c++/100689] New: internal compiler error: Segmentation fault when using modules and -g ma30002000 at yahoo dot de
@ 2024-02-11 14:11 ` nshead at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-02-11 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 14 with r14-8350-gaffef534b03355.

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

end of thread, other threads:[~2024-02-11 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20  2:52 [Bug c++/100689] New: internal compiler error: Segmentation fault when using modules and -g ma30002000 at yahoo dot de
2024-02-11 14:11 ` [Bug c++/100689] [modules] " 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).