[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 --- Comment #6 from CVS Commits --- The releases/gcc-10 branch has been updated by Richard Biener : https://gcc.gnu.org/g:7d919c33fbd29a996326840dae3b5e093c3190f4 commit r10-8355-g7d919c33fbd29a996326840dae3b5e093c3190f4 Author: Richard Biener Date: Thu Jun 4 13:44:58 2020 +0200 middle-end/95493 - bogus MEM_ATTRS for variable array access The following patch avoids keeping the inherited MEM_ATTRS when set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF. The inherited ones may not reflect the correct offset and neither does the updated alias-set match the inherited MEM_EXPR. This all ends up confusing path-based alias-analysis, causing wrong-code. The fix is to stop not adopting a MEM_EXPR for certain kinds of expressions and instead handle everything we can. There's still the constant kind trees case which I'm too lazy to look into right now. I did refrain from adding SSA_NAME there and instead avoided calling set_mem_attributes_minus_bitpos when debug expression expansion ended up expanding a SSA definition RHS which should already have taken care of setting the appropriate MEM_ATTRS. It also avoids calling set_mem_attributes on the DECL_INITIAL of a CONST_DECL which seems pointless since there cannot be a sensible MEM_EXPR derived from that. We're overwriting both other possibly useful info, alias-set and alignment immediately so the following patch simply removes the call instead of making the function deal with even more (unexpected) trees that are not memory accesses. 2020-06-23 Richard Biener PR middle-end/95493 PR middle-end/95690 * cfgexpand.c (expand_debug_expr): Avoid calling set_mem_attributes_minus_bitpos when we were expanding an SSA name. * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove ARRAY_REF special-casing, add CONSTRUCTOR to the set of special-cases we do not want MEM_EXPRs for. Assert we end up with reasonable MEM_EXPRs. * varasm.c (build_constant_desc): Remove set_mem_attributes call. * g++.dg/torture/pr95493.C: New testcase. * g++.dg/torture/pr95493-1.C: Likewise. * gfortran.dg/pr95690.f90: Likewise.
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 Richard Biener changed: What|Removed |Added Blocks||95493 Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #5 from Richard Biener --- Fixed. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95493 [Bug 95493] [10 Regression] test for vector members apparently reordered with assignment to vector members since r10-7523-gb90061c6ec090c6b
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 --- Comment #4 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:a97e49a89d11b302b12ec319a3316ba78adca02a commit r11-1349-ga97e49a89d11b302b12ec319a3316ba78adca02a Author: Richard Biener Date: Tue Jun 16 09:36:09 2020 +0200 middle-end/95690 - avoid MEM_EXPRs for constants The following avoids calling set_mem_attributes on the DECL_INITIAL of a CONST_DECL which seems pointless since there cannot be a sensible MEM_EXPR derived from that. We're overwriting both other possibly useful info, alias-set and alignment immediately so the following patch simply removes the call instead of making the function deal with even more (unexpected) trees that are not memory accesses. 2020-06-16 Richard Biener PR middle-end/95690 * varasm.c (build_constant_desc): Remove set_mem_attributes call. * gfortran.dg/pr95690.f90: New testcase.
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 --- Comment #3 from Richard Biener --- (gdb) p t $1 = (gdb) p debug_generic_expr (t) ((erfc)) so that's the DECL_INITIAL of a CONST_DECL. The CONST_DECL is built that way by the FE: 8833 /* Create a temporary var to hold the value. */ 8834 if (TREE_CONSTANT (se->expr)) 8835{ 8836 tree tmp = se->expr; 8837 STRIP_TYPE_NOPS (tmp); 8838 var = build_decl (input_location, 8839CONST_DECL, NULL, TREE_TYPE (tmp)); 8840 DECL_INITIAL (var) = tmp; and the middle-end doesn't really expect PAREN_EXPRs. I don't see any stripping of other codes on the path to the ICE so I'll amend what is already there. But IMHO build_constant_desc shouldn't pass the constant expression to be used as MEM_EXPR, instead passing down the type looks more appropriate and future-proof...
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 Richard Biener changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Target Milestone|--- |11.0 Status|NEW |ASSIGNED --- Comment #2 from Richard Biener --- I will have a look, but I guess given the error from the FE we're handing broken GENERIC to the backend.
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 Dominique d'Humieres changed: What|Removed |Added Priority|P3 |P4
[Bug fortran/95690] [11 Regression] ICE in set_mem_attributes_minus_bitpos, at emit-rtl.c:2092
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95690 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW CC||marxin at gcc dot gnu.org, ||rguenth at gcc dot gnu.org Last reconfirmed||2020-06-15 Ever confirmed|0 |1 --- Comment #1 from Martin Liška --- Started with r11-963-g80d6f89e78fc3b77.