public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "m-matti-a.lehtonen at iki dot fi" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/110328] New: Module related optimization is too aggressive
Date: Tue, 20 Jun 2023 18:26:33 +0000	[thread overview]
Message-ID: <bug-110328-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110328
           Summary: Module related optimization is too aggressive
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m-matti-a.lehtonen at iki dot fi
  Target Milestone: ---

Created attachment 55375
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55375&action=edit
Example sources

When the module example (files test.cc and test2.cc) is compiles as
> g++-12 --std=c++20 -Wall -Wextra -Werror -pedantic  -fmodules-ts -O1  -DNDEBUG test2.cc test.cc
it generates the following error:
> In file included from test.cc:4,
> of module test, imported at test2.cc:5:
> In destructor ‘virtual std::bad_optional_access::~bad_optional_access()’,
>     inlined from ‘virtual std::bad_optional_access::~bad_optional_access()’ at > test2.cc:8:15:
> /usr/include/c++/12/optional:102:13: error: ‘this’ is used uninitialized [-Werror=uninitialized]
>   102 |     virtual ~bad_optional_access() = default;
>       |             ^
> In file included from test2.cc:2:
> /usr/include/c++/12/optional: In destructor ‘virtual std::bad_optional_access::~bad_optional_access()’:
> /usr/include/c++/12/optional:102:13: note: ‘this’ was declared here
>   102 |     virtual ~bad_optional_access() = default;
>       |             ^

If the if statement at test2.cc is uncommented, no error is generated.

If basically the same code (file test3.cc) is compiled without using modules,
no problem
> g++-12 --std=c++20 -Wall -Wextra -Werror -pedantic -O1  -DNDEBUG test3.cc

Exact version and system (Ubuntu 22.04.2 LTS)
> $ g++-12  --version
> g++-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0

             reply	other threads:[~2023-06-20 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 18:26 m-matti-a.lehtonen at iki dot fi [this message]
2024-03-06 16:41 ` [Bug c++/110328] " 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-110328-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).