[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered since r9-1948

2021-02-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:f72e3d8c9ffb81d25d4fdba10056cd2197e22d64

commit r11-7275-gf72e3d8c9ffb81d25d4fdba10056cd2197e22d64
Author: Jakub Jelinek 
Date:   Thu Feb 18 09:45:19 2021 +0100

array-bounds: Fix up ICE on overaligned variables [PR99109]

check_mem_ref builds artificial arrays for variables that don't have
array type.
The C standard says:
"For the purposes of these operators, a pointer to an object that is not an
element of an
array behaves the same as a pointer to the first element of an array of
length one with the
type of the object as its element type."
so it isn't completely wrong and does simplify the function.
But, layout_type can fail if the size of the element type is not a multiple
of its alignment (i.e. overaligned types) and we then ICE because of that.

The following patch uses TYPE_MAIN_VARIANT in those cases instead, but only
for the types that need it, as for the diagnostics it is better to use the
typedef names etc. that were really used in the source if possible.

2021-02-18  Jakub Jelinek  

PR middle-end/99109
* gimple-array-bounds.cc (build_zero_elt_array_type): Rename to ...
(build_printable_array_type): ... this.  Add nelts argument.  For
overaligned eltype, use TYPE_MAIN_VARIANT (eltype) instead.  If
nelts, call build_array_type_nelts.
(array_bounds_checker::check_mem_ref): Use
build_printable_array_type
instead of build_zero_elt_array_type and build_array_type_nelts.

* g++.dg/warn/Warray-bounds-17.C: New test.

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered since r9-1948

2021-02-16 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #4 from Jakub Jelinek  ---
Created attachment 50200
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50200&action=edit
gcc11-pr99109.patch

Untested fix.

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered since r9-1948

2021-02-15 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered since r9-1948

2021-02-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

--- Comment #3 from Jakub Jelinek  ---
array_bounds_checker::check_mem_ref certainly shouldn't try to pretend there is
any ARRAY_TYPE that wasn't in the source if the type is overaligned (its size
is not a multiple of the alignment).

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered since r9-1948

2021-02-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[9/10/11 Regression] ICE:   |[9/10/11 Regression] ICE:
   |Error reporting routines|Error reporting routines
   |re-entered  |re-entered since r9-1948
 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Started with r9-1948-gd893b683f40884cd00b5beb392566ecc7b67f721

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered

2021-02-15 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |9.4

[Bug middle-end/99109] [9/10/11 Regression] ICE: Error reporting routines re-entered

2021-02-15 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99109

Marek Polacek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-02-15
 Status|UNCONFIRMED |NEW

--- Comment #1 from Marek Polacek  ---
Confirmed.