public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112588] New: ICE in make_decl_rtl when returning str literal when string header imported in module
@ 2023-11-17 14:24 nickbegg at gmail dot com
  2023-11-18  0:40 ` [Bug c++/112588] " nathanieloshead at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nickbegg at gmail dot com @ 2023-11-17 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112588
           Summary: ICE in make_decl_rtl when returning str literal when
                    string header imported in module
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickbegg at gmail dot com
  Target Milestone: ---

Created attachment 56622
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56622&action=edit
-freport-bug output

/home/nick/gcc-trunk-debug-inst/include/c++/14.0.0/bits/allocator.h:191:39:
internal compiler error: in make_decl_rtl, at varasm.cc:1442
  191 |             if (__builtin_mul_overflow(__n, sizeof(_Tp), &__n))
      |                 ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

Using when importing a module into a non-module TU, #including string in both
causes an ICE when returning a string literal in a function with std::string
return type -

////////////////////////
// modA.mpp (compiled as module):

module;

#include <string>

export module modA;

///////////////////////
// main.cpp (compiled as regular TU): 

#include <string>

import modA;

std::string test_func() {
    return "foo";
}

int main() {
    return 0;
}
///////////////////////

The ICE happens when compiling main.cpp.

Removing the import from main.cpp, or returning std::string() from test_func()
stops the ICE. 

GCC trunk (14) version, git rev ba3f5b8465ef7b278ea33ff94cd85b9638058635

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

end of thread, other threads:[~2024-03-06 22:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 14:24 [Bug c++/112588] New: ICE in make_decl_rtl when returning str literal when string header imported in module nickbegg at gmail dot com
2023-11-18  0:40 ` [Bug c++/112588] " nathanieloshead at gmail dot com
2023-12-01  9:10 ` pinskia at gcc dot gnu.org
2024-01-08 17:06 ` ppalka at gcc dot gnu.org
2024-01-17 23:48 ` [Bug c++/112588] [modules] " cvs-commit at gcc dot gnu.org
2024-01-19  1:00 ` hp at gcc dot gnu.org
2024-01-27 10:31 ` nshead at gcc dot gnu.org
2024-03-06 22:08 ` 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).