public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nickbegg at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/112588] New: ICE in make_decl_rtl when returning str literal when string header imported in module
Date: Fri, 17 Nov 2023 14:24:01 +0000	[thread overview]
Message-ID: <bug-112588-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2023-11-17 14:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 14:24 nickbegg at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112588-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).