From patchwork Sat Dec 8 11:42:31 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 From: Eric Botcazou X-Patchwork-Id: 204644 Message-Id: <1486156.RQZsauqaQ0@polaris> To: gcc-patches@gcc.gnu.org Date: Sat, 08 Dec 2012 12:42:31 +0100 This is an internal error in for_each_index at -O: +===========================GNAT BUG DETECTED==============================+ | 4.8.0 20121208 (experimental) [trunk revision 194319] (x86_64-suse-linux) GCC error:| | in for_each_index, at tree-ssa-loop-im.c:324 | | Error detected around vect9.adb:45:1| The callback is invoked on a vector CONST_DECL and stops. That's an unusual situation (the CONST_DECL is wrapped up in a VIEW_CONVERT_EXPR to array type) but IMO there is no reason to accept other DECLs and stop on CONST_DECLs. Tested on x86_64-suse-linux, applied on the mainline as obvious. 2012-12-08 Eric Botcazou * tree-ssa-loop-im.c (for_each_index) : New case. 2012-12-08 Eric Botcazou * gnat.dg/vect9.ad[sb]: New test. * gnat.dg/vect9_pkg.ads: New helper. Index: tree-ssa-loop-im.c =================================================================== --- tree-ssa-loop-im.c (revision 194319) +++ tree-ssa-loop-im.c (working copy) @@ -291,6 +291,7 @@ for_each_index (tree *addr_p, bool (*cbc case VAR_DECL: case PARM_DECL: + case CONST_DECL: case STRING_CST: case RESULT_DECL: case VECTOR_CST: