This fixes an ICE in case we use weirdo --param value for 
PARAM_ALIGN_THRESHOLD.  The patch is by Andrew; I added CL, testcase
and tested.
Bootstrapped/regtested on x86_64-linux, ok for trunk?  And what about other
branches?

2013-04-04  Marek Polacek  <pola...@redhat.com>
            Andrew Pinski  <apin...@cavium.com>

        PR tree-optimization/48184
        * final.c (compute_alignments): Set threshold to 0
        if PARAM_ALIGN_THRESHOLD is 0.

        * gcc.dg/pr48184.c: New test.

--- gcc/final.c.mp      2013-04-04 14:09:04.626020852 +0200
+++ gcc/final.c 2013-04-04 14:09:05.672024174 +0200
@@ -701,7 +701,10 @@ compute_alignments (void)
   FOR_EACH_BB (bb)
     if (bb->frequency > freq_max)
       freq_max = bb->frequency;
-  freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD);
+  if (PARAM_VALUE (PARAM_ALIGN_THRESHOLD) == 0)
+    freq_threshold = 0;
+  else
+    freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD);
 
   if (dump_file)
     fprintf(dump_file, "freq_max: %i\n",freq_max);
--- gcc/testsuite/gcc.dg/pr48184.c.mp   2013-04-04 13:23:15.356769534 +0200
+++ gcc/testsuite/gcc.dg/pr48184.c      2013-04-04 14:05:05.506241464 +0200
@@ -0,0 +1,5 @@
+/* PR tree-optimization/48184 */
+/* { dg-do compile } */
+/* { dg-options "-O --param align-threshold=0" } */
+
+void foo (void) { }

        Marek

Reply via email to