public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
@ 2023-12-12 15:56 vries at gcc dot gnu.org
  2023-12-24  9:24 ` [Bug build/31150] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-12-12 15:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

            Bug ID: 31150
           Summary: [gdb/build] m_uiout may be used uninitialized in this
                    function [-Wmaybe-uninitialized]
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When building with -O2, I've started to see these warnings:
...
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘bkpt_tuple_emitter.ui_out_emit_type<(ui_out_type)0>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘outer_tuple_emitter.ui_out_emit_type<(ui_out_type)0>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘inner_list_emitter.ui_out_emit_type<(ui_out_type)1>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘list_emitter.ui_out_emit_type<(ui_out_type)1>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘tuple_emitter.ui_out_emit_type<(ui_out_type)0>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘asm_list.ui_out_emit_type<(ui_out_type)1>::m_uiout’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘output_tuple.ui_out_emit_type<(ui_out_type)0>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
/data/vries/gdb/src/gdb/ui-out.h:409:18: warning:
‘sources_list.ui_out_emit_type<(ui_out_type)1>::m_uiout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
@ 2023-12-24  9:24 ` vries at gcc dot gnu.org
  2023-12-24  9:33 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-12-24  9:24 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Bisects to:
...
commit 6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b
Author: Lancelot Six <lancelot.six@amd.com>
Date:   Fri Oct 13 09:27:48 2023 +0000

    gdb: Replace gdb::optional with std::optional
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
  2023-12-24  9:24 ` [Bug build/31150] " vries at gcc dot gnu.org
@ 2023-12-24  9:33 ` vries at gcc dot gnu.org
  2023-12-24 17:51 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-12-24  9:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
This seems to fix it:
...
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 07567a1df35..0ff9b761102 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -406,14 +405,15 @@ class ui_out_emit_type

   ~ui_out_emit_type ()
   {
-    m_uiout->end (Type);
+    if (m_uiout != nullptr)
+      m_uiout->end (Type);
   }

   DISABLE_COPY_AND_ASSIGN (ui_out_emit_type);

 private:

-  struct ui_out *m_uiout;
+  struct ui_out *m_uiout = nullptr;
 };

 typedef ui_out_emit_type<ui_out_type_tuple> ui_out_emit_tuple;
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
  2023-12-24  9:24 ` [Bug build/31150] " vries at gcc dot gnu.org
  2023-12-24  9:33 ` vries at gcc dot gnu.org
@ 2023-12-24 17:51 ` tromey at sourceware dot org
  2023-12-25 11:50 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-12-24 17:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Which compiler is this?
I think this was https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-12-24 17:51 ` tromey at sourceware dot org
@ 2023-12-25 11:50 ` vries at gcc dot gnu.org
  2023-12-25 17:42 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-12-25 11:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #3)
> Which compiler is this?
> I think this was https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635

That particular PR is fixed in gcc 11.1, and this is with gcc 11.4 on ubuntu
22.04.

Anyway, this fixes it as well:
...
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 07567a1df35..ce3bc86b651 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -406,7 +406,10 @@ class ui_out_emit_type

   ~ui_out_emit_type ()
   {
+    DIAGNOSTIC_PUSH
+    DIAGNOSTIC_IGNORE ("-Wmaybe-uninitialized")
     m_uiout->end (Type);
+    DIAGNOSTIC_POP
   }

   DISABLE_COPY_AND_ASSIGN (ui_out_emit_type);
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-12-25 11:50 ` vries at gcc dot gnu.org
@ 2023-12-25 17:42 ` tromey at sourceware dot org
  2024-01-04 12:03 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-12-25 17:42 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Maybe another compiler bug report is needed.
It would be good to see the full location of the warnings --
the context of the code, not just the immediate spot.
It could possibly be a bug there (though I still tend
to think it's a compiler problem).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-12-25 17:42 ` tromey at sourceware dot org
@ 2024-01-04 12:03 ` vries at gcc dot gnu.org
  2024-01-04 12:04 ` vries at gcc dot gnu.org
  2024-01-05 10:23 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-01-04 12:03 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15282
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15282&action=edit
c-reduced symtab.ii

$ wc -l symtab.ii
958 symtab.ii

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-04 12:03 ` vries at gcc dot gnu.org
@ 2024-01-04 12:04 ` vries at gcc dot gnu.org
  2024-01-05 10:23 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-01-04 12:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15283
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15283&action=edit
c-reduce script

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/31150] [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized]
  2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-01-04 12:04 ` vries at gcc dot gnu.org
@ 2024-01-05 10:23 ` ssbssa at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-05 10:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31150

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-01-05 10:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12 15:56 [Bug build/31150] New: [gdb/build] m_uiout may be used uninitialized in this function [-Wmaybe-uninitialized] vries at gcc dot gnu.org
2023-12-24  9:24 ` [Bug build/31150] " vries at gcc dot gnu.org
2023-12-24  9:33 ` vries at gcc dot gnu.org
2023-12-24 17:51 ` tromey at sourceware dot org
2023-12-25 11:50 ` vries at gcc dot gnu.org
2023-12-25 17:42 ` tromey at sourceware dot org
2024-01-04 12:03 ` vries at gcc dot gnu.org
2024-01-04 12:04 ` vries at gcc dot gnu.org
2024-01-05 10:23 ` ssbssa at sourceware dot 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).