[Bug c/99131] New: gcc doesn't detect missing comma in array initialisation
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 17 10:35:26 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99131
Bug ID: 99131
Summary: gcc doesn't detect missing comma in array
initialisation
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
For this C code:
const char * a[ 4] = {
" fred ",
" bert "
" harry ",
" eric "
};
Note missing "," on the bert line. gcc doesn't say very much:
$ /home/dcb/gcc/results/bin/gcc -c -g -O2 -Wall -Wextra feb17f.cc
$
Here is a recent clang doing something more useful:
$ /home/dcb/llvm/clang1200rc1/bin/clang++ -c -g -O2 -Wall -Wextra feb17f.cc
feb17f.cc:7:2: warning: suspicious concatenation of string literals in an array
initialization; did you mean to separate the elements with a comma?
[-Wstring-concatenation]
" harry ",
^
feb17f.cc:6:2: note: place parentheses around the string literal to silence
warning
" bert "
^
1 warning generated.
More information about the Gcc-bugs
mailing list