From patchwork Tue Dec 11 09:12:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix ICE on loop over constant vector at -O Date: Mon, 10 Dec 2012 23:12:50 -0000 From: Eric Botcazou X-Patchwork-Id: 205140 Message-Id: <3439897.HpEVehmzsD@polaris> To: Richard Biener Cc: gcc-patches@gcc.gnu.org > ... so if would really be a pessimization doing that. Of course handling > CONST_DECL in for_each_index is indeed obvious - I just was curios if > it was a missed-optimization opportunity as well. It turns out that, for the same testcase, &CONST_DECL is generated on the MIPS and prepare_decl_rtl is trying to put an RTX on the CONST_DECL, hence ICE. Tested on x86_64-suse-linux, applied on the mainline as obvious. I agree that this is on the fringes of what we have to support, but we won't revisit it until the 4.9 development cycle. 2012-12-11 Eric Botcazou * tree-ssa-loop-ivopts.c (prepare_decl_rtl) : Generate RTL only for a DECL which HAS_RTL_P. Index: tree-ssa-loop-ivopts.c =================================================================== --- tree-ssa-loop-ivopts.c (revision 194382) +++ tree-ssa-loop-ivopts.c (working copy) @@ -2806,7 +2806,7 @@ prepare_decl_rtl (tree *expr_p, int *ws, expr_p = &TREE_OPERAND (*expr_p, 0)) continue; obj = *expr_p; - if (DECL_P (obj) && !DECL_RTL_SET_P (obj)) + if (DECL_P (obj) && HAS_RTL_P (obj) && !DECL_RTL_SET_P (obj)) x = produce_memory_decl_rtl (obj, regno); break;