[Bug c/70952] New: Missing warning for likely-erroneous octal escapes in string literals
amonakov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 4 16:57:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70952
Bug ID: 70952
Summary: Missing warning for likely-erroneous octal escapes in
string literals
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: amonakov at gcc dot gnu.org
Target Milestone: ---
GCC doesn't warn for:
const char s[] = "\008";
(just the two zeros following the backslash become a part of the octal literal,
so the string literal is equivalent to "\0""8")
\008 and \009 in string literals are most likely errors (\08 and \09 work just
as well if a nil character followed by a digit was really intended)
I think a bit of a bikeshed is possible on the point how far we want to take it
(do we warn for "\08"? for "\799"?). I think warning when the octal escape
with less than 3 digits is followed by [89] is desirable (this catches all of
the above), but warning when octal escape already has 3 digits may be not (this
exempts "\0009" from the warning).
More information about the Gcc-bugs
mailing list