public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
@ 2020-07-22 13:22 vries at gcc dot gnu.org
  2020-07-22 13:23 ` [Bug tdep/26279] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-22 13:22 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26279
           Summary: [s390, Wmaybe-uninitialized] Warnings in
                    opcodes/s390-mkopc.c
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Warnings with -Wall:
...
/home/vries/gdb_versions/devel/src/opcodes/s390-mkopc.c: In function 'main':
/home/vries/gdb_versions/devel/src/opcodes/s390-mkopc.c:171:7: warning:
'ext_table_length' may be used uninitialized in this function
[-Wmaybe-uninitialized]
  171 |   int ext_table_length;
      |       ^~~~~~~~~~~~~~~~
/home/vries/gdb_versions/devel/src/opcodes/s390-mkopc.c:170:38: warning:
'ext_table' may be used uninitialized in this function [-Wmaybe-uninitialized]
  170 |   const struct s390_cond_ext_format *ext_table;
      |                                      ^~~~~~~~~
...

Corresponding code:
...
  const struct s390_cond_ext_format *ext_table;
  int ext_table_length;

  ...

  switch (*tag)
    {
    case '*':
      ext_table = s390_cond_extensions;
      ext_table_length = NUM_COND_EXTENSIONS;
      break;
    case '$':
      ext_table = s390_crb_extensions;
      ext_table_length = NUM_CRB_EXTENSIONS;
      break;
    default: fprintf (stderr, "Unknown tag char: %c\n", *tag);
    }

  for (i = 0; i < ext_table_length; i++)
    {
      char new_mnemonic[15];

      strcpy (new_mnemonic, prefix);
      opcode[mask_start] = ext_table[i].nibble;
      strcat (new_mnemonic, ext_table[i].extension);
      strcat (new_mnemonic, suffix);
      insertOpcode (opcode, new_mnemonic, format, min_cpu, mode_bits, flags);
    }
...

-- 
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:[~2020-07-29 17:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
2020-07-22 13:23 ` [Bug tdep/26279] " vries at gcc dot gnu.org
2020-07-22 13:25 ` vries at gcc dot gnu.org
2020-07-23 11:53 ` arnez at linux dot ibm.com
2020-07-27 16:05 ` arnez at linux dot ibm.com
2020-07-27 16:08 ` vries at gcc dot gnu.org
2020-07-27 16:34 ` vries at gcc dot gnu.org
2020-07-29 16:35 ` vries at gcc dot gnu.org
2020-07-29 17:50 ` arnez at linux dot ibm.com

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).