public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/94182] New: Document -Wchar-subscripts
@ 2020-03-15 18:53 roland.illig at gmx dot de
2020-03-15 18:54 ` [Bug other/94182] " roland.illig at gmx dot de
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: roland.illig at gmx dot de @ 2020-03-15 18:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
Bug ID: 94182
Summary: Document -Wchar-subscripts
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: roland.illig at gmx dot de
Target Milestone: ---
The current documentation on the -Wchar-subscripts option is nearly useless
since it doesn't explain anything. I've made an attempt to summarize and
explain the situation here:
https://stackoverflow.com/a/60696378
The GCC documentation should at least include some pointers where to find more
information about this warning, especially since there are so many ways to fix
the warning incorrectly.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/94182] Document -Wchar-subscripts
2020-03-15 18:53 [Bug other/94182] New: Document -Wchar-subscripts roland.illig at gmx dot de
@ 2020-03-15 18:54 ` roland.illig at gmx dot de
2020-03-15 19:50 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: roland.illig at gmx dot de @ 2020-03-15 18:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
--- Comment #1 from Roland Illig <roland.illig at gmx dot de> ---
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/94182] Document -Wchar-subscripts
2020-03-15 18:53 [Bug other/94182] New: Document -Wchar-subscripts roland.illig at gmx dot de
2020-03-15 18:54 ` [Bug other/94182] " roland.illig at gmx dot de
@ 2020-03-15 19:50 ` pinskia at gcc dot gnu.org
2020-03-16 3:29 ` roland.illig at gmx dot de
2020-05-19 12:35 ` [Bug other/94182] Improve -Wchar-subscripts documentation egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-15 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Considering it is documented in another place where char is signed or unsigned.
I don't know if this needs to change.
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Characters-implementation.html#Characters-implementation
Which of signed char or unsigned char has the same range, representation, and
behavior as “plain” char (C90 6.1.2.5, C90 6.2.1.1, C99 and C11 6.2.5, C99 and
C11 6.3.1.1).
Determined by ABI. The options -funsigned-char and -fsigned-char change the
default. See Options Controlling C Dialect.
----- CUT -----
Plus -funsigned-char/-fsigned-char
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/94182] Document -Wchar-subscripts
2020-03-15 18:53 [Bug other/94182] New: Document -Wchar-subscripts roland.illig at gmx dot de
2020-03-15 18:54 ` [Bug other/94182] " roland.illig at gmx dot de
2020-03-15 19:50 ` pinskia at gcc dot gnu.org
@ 2020-03-16 3:29 ` roland.illig at gmx dot de
2020-05-19 12:35 ` [Bug other/94182] Improve -Wchar-subscripts documentation egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: roland.illig at gmx dot de @ 2020-03-16 3:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
--- Comment #3 from Roland Illig <roland.illig at gmx dot de> ---
(In reply to Andrew Pinski from comment #2)
> Considering it is documented in another place where char is signed or
> unsigned. I don't know if this needs to change.
Given only the compiler warning about "char subscript", how could I possibly
get to the documentation you linked?
> int demo(char ch, int *data) {
> return data[ch];
> }
When I try to compile this code, I get:
> bad.c:2:16: warning: array subscript has type 'char' [-Wchar-subscripts]
>From there I can look up the documentation of that command line option. But how
could I get from there to your documentation? And, considering an _average_ GCC
user (instead of an active GCC developer), would I have a chance of
understanding the underlying problem and fixing it correctly? The GCC
documentation should at least try to educate the reader a bit.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/94182] Improve -Wchar-subscripts documentation
2020-03-15 18:53 [Bug other/94182] New: Document -Wchar-subscripts roland.illig at gmx dot de
` (2 preceding siblings ...)
2020-03-16 3:29 ` roland.illig at gmx dot de
@ 2020-05-19 12:35 ` egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-05-19 12:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94182
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |egallager at gcc dot gnu.org
Summary|Document -Wchar-subscripts |Improve -Wchar-subscripts
| |documentation
Ever confirmed|0 |1
Last reconfirmed| |2020-05-19
Status|UNCONFIRMED |NEW
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
retitling to clarify what exactly the issue is, and confirming
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-19 12:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 18:53 [Bug other/94182] New: Document -Wchar-subscripts roland.illig at gmx dot de
2020-03-15 18:54 ` [Bug other/94182] " roland.illig at gmx dot de
2020-03-15 19:50 ` pinskia at gcc dot gnu.org
2020-03-16 3:29 ` roland.illig at gmx dot de
2020-05-19 12:35 ` [Bug other/94182] Improve -Wchar-subscripts documentation egallager 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).