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
* [Bug tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
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 ` vries at gcc dot gnu.org
2020-07-22 13:25 ` vries at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-22 13:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arnez at linux dot ibm.com,
| |uweigand 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
* [Bug tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
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
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-22 13:25 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |s390
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
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
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: arnez at linux dot ibm.com @ 2020-07-23 11:53 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
Andreas Arnez <arnez at linux dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |krebbel at linux dot ibm.com
--- Comment #1 from Andreas Arnez <arnez at linux dot ibm.com> ---
This is what seems to happen here:
The function insertExpandedMnemonic() searches for the first occurrence of
'*' or '$' in the given mnemonic and then continues processing based on
the result. In particular, if one of these "tag characters" is found in
the mnemonic, an extension table is chosen using a switch() on that
character. The switch statement contains an unreachable default case that
prints an error message and does not set the extension table. GCC
obviously fails to recognize that this case is unreachable. Instead it
concludes that the extension table might have been left uninitialized
after the switch statement and consequently emits maybe-uninitialized
warnings for the variables 'ext_table' and 'ext_table_length'.
I assume the false positive can easily be avoided by adding a return statement
after printing the error, or with an appropriate assert() beforehand. Does
anyone have a preference?
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
` (2 preceding siblings ...)
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
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: arnez at linux dot ibm.com @ 2020-07-27 16:05 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
--- Comment #2 from Andreas Arnez <arnez at linux dot ibm.com> ---
Created attachment 12726
--> https://sourceware.org/bugzilla/attachment.cgi?id=12726&action=edit
Handle the default case with abort()
This replaces the fprintf() in the default case by a call to abort(). Not sure
if this helps, since I don't see the warning in my testing.
Tom, which compiler are you using? Does the patch help?
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
` (3 preceding siblings ...)
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
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-27 16:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Andreas Arnez from comment #2)
> Created attachment 12726 [details]
> Handle the default case with abort()
>
> This replaces the fprintf() in the default case by a call to abort(). Not
> sure if this helps, since I don't see the warning in my testing.
>
> Tom, which compiler are you using?
Warning shows up at -O2, with gcc-7 .. gcc-11.
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
` (4 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-27 16:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Andreas Arnez from comment #2)
> Does the patch help?
Yes :)
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
` (5 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-29 16:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #4)
> (In reply to Andreas Arnez from comment #2)
> > Does the patch help?
>
> Yes :)
Do you want to take care of the commit? If not, I can do it.
--
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 tdep/26279] [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c
2020-07-22 13:22 [Bug tdep/26279] New: [s390, Wmaybe-uninitialized] Warnings in opcodes/s390-mkopc.c vries at gcc dot gnu.org
` (6 preceding siblings ...)
2020-07-29 16:35 ` vries at gcc dot gnu.org
@ 2020-07-29 17:50 ` arnez at linux dot ibm.com
7 siblings, 0 replies; 9+ messages in thread
From: arnez at linux dot ibm.com @ 2020-07-29 17:50 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26279
Andreas Arnez <arnez at linux dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #6 from Andreas Arnez <arnez at linux dot ibm.com> ---
Committed as 9811697376b3f1950419ab13b19e2995703b839b.
--
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).