public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/109559] New: Unexpected -Wmaybe-uninitialized warning when inlining with system header
@ 2023-04-19 20:23 mpolacek at gcc dot gnu.org
  2023-04-19 20:25 ` [Bug middle-end/109559] [12/13/14 Regression] " mpolacek at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-04-19 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109559
           Summary: Unexpected -Wmaybe-uninitialized warning when inlining
                    with system header
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The following testcase (the directives simulate a system header) triggers a
-Wmaybe-uninitialized warning:

$ xg++ -c un.cc -Wall -O2
In member function ‘int function1::swap(function1)’,
    inlined from ‘int function::operator=(Functor) [with Functor =
FilonIntegral::integrate() const::<lambda()>]’ at :8:56,
    inlined from ‘double FilonIntegral::integrate() const’ at :9:6:
:5:49: warning: ‘f1’ may be used uninitialized [-Wmaybe-uninitialized]
: In member function ‘double FilonIntegral::integrate() const’:
:1:3: note: by argument 1 of type ‘const function_base*’ to ‘int
function_base::has_trivial_copy_and_destroy() const’ declared here
:8:12: note: ‘f1’ declared here

$ xg++ -c un.cc -Wall -O2 -fno-inline
# nothing

# 0 "" 3
struct function_base {
  has_trivial_copy_and_destroy() const;
  int functor;
};
struct function1 : function_base {
  swap(function1) { has_trivial_copy_and_destroy(); }
};
struct function : function1 {
  template <typename Functor> operator=(Functor) { swap(*this); }
};
# 4 ""
struct FilonIntegral {
  double integrate() const;
};
double FilonIntegral::integrate() const {
  function f1;
  f1 = [] {};
  return 0;
}

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

end of thread, other threads:[~2024-02-06  9:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 20:23 [Bug middle-end/109559] New: Unexpected -Wmaybe-uninitialized warning when inlining with system header mpolacek at gcc dot gnu.org
2023-04-19 20:25 ` [Bug middle-end/109559] [12/13/14 Regression] " mpolacek at gcc dot gnu.org
2023-04-19 20:30 ` mpolacek at gcc dot gnu.org
2023-05-08 12:27 ` rguenth at gcc dot gnu.org
2024-01-12 10:29 ` rguenth at gcc dot gnu.org
2024-02-01 22:12 ` mpolacek at gcc dot gnu.org
2024-02-05 10:45 ` rguenth at gcc dot gnu.org
2024-02-05 12:36 ` rguenth at gcc dot gnu.org
2024-02-05 13:00 ` rguenth at gcc dot gnu.org
2024-02-06  9:53 ` rguenth 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).