https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

            Bug ID: 89507
           Summary: bogus "size of array exceeds maximum object size"
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
                CC: caolanm at redhat dot com, msebor at gcc dot gnu.org
  Target Milestone: ---

With current trunk (towards GCC 9),

> $ cat test.cc
> unsigned char const n = 128;
> int * p = new int[n];
>
> $ g++ -c test.cc
> test.cc:2:20: error: size ‘128’ of array exceeds maximum object size 
> ‘9223372036854775807’
>     2 | int * p = new int[n];
>       |                    ^

This looks like a regression introduced with
<https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=268774> "PR c++/87996 -
size of array is negative error when SIZE_MAX/2 < sizeof(array) <= SIZE_MAX". 
(This breaks the build of LibreOffice,

> [CXX] i18npool/source/characterclassification/cclass_unicode_parser.cxx
> i18npool/source/characterclassification/cclass_unicode_parser.cxx: In member 
> function ‘void i18npool::cclass_Unicode::initParserTable(const 
> com::sun::star::lang::Locale&, sal_Int32, const rtl::OUString&, sal_Int32, 
> const rtl::OUString&)’:
> i18npool/source/characterclassification/cclass_unicode_parser.cxx:417:45: 
> error: size ‘128’ of array exceeds maximum object size ‘9223372036854775807’
>   417 |         pTable.reset(new ParserFlags[nDefCnt]);
>       |                                             ^

.)

Reply via email to