[PATCH] D58896: Suppress -Wchar-subscripts if the index is a literal char

Edward Jones via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 09:42:29 PST 2019


edward-jones added a comment.

In D58896#1737113 <https://reviews.llvm.org/D58896#1737113>, @sberg wrote:

> But how about literals like `'\x80'` where the promoted value depends on whether plain `char` is signed or unsigned?


If 'char' is signed and index into an array then this will typically trigger an `-Warray-bounds` warning because it references before the start of the array.

In D58896#1737200 <https://reviews.llvm.org/D58896#1737200>, @xbolva00 wrote:

> Well, i am not sure if one twitter report is good motivation to criple warning.


The motivation for suppressing the warning was that it is not uncommon to use a character literal in lookup tables. In addition in brings the warning inline with the behaviour of `-Wchar-subscripts` in GCC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58896/new/

https://reviews.llvm.org/D58896





More information about the cfe-commits mailing list