https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70952
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|REOPENED |NEW --- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Alexander Monakov from comment #5) > No, it's not a dup? Invalid octal literals outside of strings are already > properly diagnosed, so the other bug talks about warning about them _as a > matter of style_. This bug is about confusing use of octal literals in > string constants. Compare: > > char c=008; > > error: invalid digit "8" in octal constant > > char c[]="\008"; > > [silently accepted with -Wall -Wextra, emits a string literal of size 3] (In reply to Alexander Monakov from comment #0) > 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). Oops, sorry, putting back in NEW