https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126739
Bug ID: 126739
Summary: [16 regression] false positive -Warray-bounds
Product: gcc
Version: 16.1.1
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Target: riscv64-*-*
Created attachment 65277
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65277&action=edit
json_schema_converter.ii
$ gcc-16 -O2 -Warray-bounds -S json_schema_converter.ii
json_schema_converter.ii:61:3: warning: access declarations are deprecated in
favor of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
61 | _Base::_Base;
| ^~~~~
json_schema_converter.ii:68:3: warning: access declarations are deprecated in
favor of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
68 | _Base::_Base;
| ^~~~~
json_schema_converter.ii:75:3: warning: access declarations are deprecated in
favor of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
75 | _Base::_Base;
| ^~~~~
json_schema_converter.ii:82:3: warning: access declarations are deprecated in
favor of using-declarations; suggestion: add the ‘using’ keyword [-Wdeprecated]
82 | _Base::_Base;
| ^~~~~
In member function ‘char* Trans_NS___cxx11_basic_string::c_str() const’,
inlined from ‘virtual char* xgrammar::<unnamed struct>::what() const’ at
json_schema_converter.ii:112:50,
inlined from ‘xgrammar::{anonymous}::SchemaErrorType xgrammar::{anonymous}:
ParseInteger()’ at json_schema_converter.ii:130:23,
inlined from ‘void xgrammar::JSONSchemaToEBNF()’ at
json_schema_converter.ii:134:39:
json_schema_converter.ii:23:32: warning: array subscript 2 is outside array
bounds of ‘xgrammar::Result<long int,
xgrammar::TypedError<xgrammar::{anonymous}::SchemaErrorType> > [1]’
[-Warray-bounds=]
23 | char *c_str() const { return _M_p; }
| ^~~~
json_schema_converter.ii: In function ‘void xgrammar::JSONSchemaToEBNF()’:
json_schema_converter.ii:128:4: note: at offset 32 into object ‘<anonymous>’ of
size 8
126 | [](int) -> Result<long, TypedError<SchemaErrorType>> {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127 | return ParseInteger_val;
| ~~~~~~~~~~~~~~~~~~~~~~~~
128 | }(ParseInteger___trans_tmp_1)
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~