[Bug tree-optimization/81884] [6/7/8 Regression] Invalid code generation with zero size arrays or flexible array members

2017-08-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81884

Richard Biener  changed:

   What|Removed |Added

  Attachment #42000|0   |1
is obsolete||

--- Comment #4 from Richard Biener  ---
Created attachment 42003
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42003=edit
updated patch

[Bug tree-optimization/81884] [6/7/8 Regression] Invalid code generation with zero size arrays or flexible array members

2017-08-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81884

--- Comment #3 from Richard Biener  ---
Regresses gfortran.dg/reassoc_4.f because we no longer DSE

@@ -207,6 +207,7 @@
   _28 = *weight_94(D);
   _29 = _27 * _28;
   _30 = _10 + _29;
+  *s_91(D)[_9] = _30;
   _173 = _12 + 9;
   _174 = _17 + _173;
   _175 = _19 + _174;
@@ -226,6 +227,7 @@
   _193 = _189 * _192;
   _194 = _28 * _193;
   _195 = _185 + _194;
+  *s_91(D)[_9] = _195;
...

so the restriction is too broad.  Now the question is if we want to allow

struct S { int a[0]; };
struct S (*p)[1];

and (*p)[0].a[4].  Or array of size n and (*p)[n-1].a[4]...

[Bug tree-optimization/81884] [6/7/8 Regression] Invalid code generation with zero size arrays or flexible array members

2017-08-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81884

--- Comment #2 from Richard Biener  ---
Created attachment 42000
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42000=edit
patch in testing

[Bug tree-optimization/81884] [6/7/8 Regression] Invalid code generation with zero size arrays or flexible array members

2017-08-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81884

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
   Priority|P3  |P2
  Known to work||5.4.0
   Target Milestone|--- |6.5
Summary|Invalid code generation |[6/7/8 Regression] Invalid
   |with zero size arrays or|code generation with zero
   |flexible array members  |size arrays or flexible
   ||array members