[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Fixed.

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Tue Feb 26 21:27:33 2019
New Revision: 269233

URL: https://gcc.gnu.org/viewcvs?rev=269233=gcc=rev
Log:
PR c++/89507
* tree.c (valid_constant_size_p): Deal with size INTEGER_CSTs
with types other than sizetype/ssizetype.

* g++.dg/other/new2.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/other/new2.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree.c

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org

--- Comment #5 from Martin Sebor  ---
Since Jakub already has a fix I'm unassigning myself.

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

--- Comment #4 from Jakub Jelinek  ---
The reason to change tree.c rather than doing something on the cp/init.c side
is the comment there that the checking ought to be done before conversion to
std::size_t (and also, we'd fold to sizetype just for the purposes of the
diagnostics and throw away the result).

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

--- Comment #3 from Jakub Jelinek  ---
Created attachment 45828
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45828=edit
gcc9-pr89507.patch

Untested patch I have right now.

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

Martin Sebor  changed:

   What|Removed |Added

   Keywords|diagnostic  |rejects-valid
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-02-26
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
Let me look into it.

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
valid_constant_size_p assumes it is sizetype/ssizetype constant, but in this
case we check it before converting it to sizetype.  Checking now if it is just
one spot or if there aren't others.

[Bug c++/89507] [9 Regression] bogus "size of array exceeds maximum object size"

2019-02-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89507

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
   Priority|P3  |P1
 Blocks||87996
   Target Milestone|--- |9.0
Summary|bogus "size of array|[9 Regression] bogus "size
   |exceeds maximum object  |of array exceeds maximum
   |size"   |object size"


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87996
[Bug 87996] [8 Regression] "size of array is negative" error when SIZE_MAX/2 <
sizeof(array) <= SIZE_MAX