[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-09 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

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

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

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

https://gcc.gnu.org/g:0673fc691175bfdb72d70c2fbbfcad238a3a9942

commit r11-5875-g0673fc691175bfdb72d70c2fbbfcad238a3a9942
Author: Jakub Jelinek 
Date:   Wed Dec 9 09:36:11 2020 +0100

fold-const: Fix native_encode_initializer bitfield handling [PR98199]

With the bit_cast changes, I have added support for bitfields which don't
have scalar representatives.  For bit_cast it works fine, as when mask
is non-NULL, off is asserted to be 0.  But when native_encode_initializer
is called e.g. from sccvn with off > 0 (i.e. we are interested in encoding
just a few bytes out of it somewhere from the middle or at the end), the
following computations are incorrect.
pos is a byte position from the start of the constructor, repr_size is the
size in bytes of the bit-field representative and len is the length
of the buffer.  If the buffer is offsetted by positive off, those numbers
are uncomparable though, we need to add off to len to make both
count bytes from the start of the constructor, and o is a utility temporary
set to off != -1 ? off : 0 (because off -1 also means start at offset 0
and just force special behavior).

2020-12-09  Jakub Jelinek  

PR tree-optimization/98199
* fold-const.c (native_encode_initializer): Fix handling bit-fields
when off > 0.

* gcc.c-torture/compile/pr98199.c: New test.

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

--- Comment #5 from Jakub Jelinek  ---
I'm pretty sure it started with
r11-5704-g896048cf43d5eb21ab7c16553bb9d13b0f890b81

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-08 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

--- Comment #4 from Alex Coplan  ---
Ah, yeah, apologies: looks like I messed up the bisect here, scratch that.

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-08 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

--- Comment #3 from Eric Botcazou  ---
> struct b {
>   long a;
>   short d;
>   int c;
>   int f;
>   int e;
>   int g;
> };
> struct h {
>   int a;
>   int i;
>   short j;
>   struct b k;
>   signed : 20;
>   int e;
>   int g;
> } __attribute__((packed));
> struct {
>   short a;
>   unsigned i;
>   unsigned k;
>   struct h d;
>   const int : 30;
>   signed e : 20;
>   signed : 18;
> } const l = {1, 6, 0, {}, 0};
> int m() { return l.e || 0; }
> 
> since r11-5706-g277ff3406d533990e98cf1c2075b9dc9db6fa48a. 

Something went wrong on your side here, this cannot possibly be true.

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

Jakub Jelinek  changed:

   What|Removed |Added

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

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

Untested fix.

[Bug tree-optimization/98199] [11 Regression] ICE: Aborted (stack smashing detected)

2020-12-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98199

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P1
 CC||jakub at gcc dot gnu.org
   Target Milestone|--- |11.0
  Component|c   |tree-optimization