Bug 25911 - [4.2 Regression] ice in vect_recog_dot_prod_pattern
Summary: [4.2 Regression] ice in vect_recog_dot_prod_pattern
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
Depends on:
Blocks: 25925
  Show dependency treegraph
 
Reported: 2006-01-22 14:04 UTC by David Binderman
Modified: 2006-01-29 17:06 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-23 18:37:52


Attachments
c source code (10.97 KB, application/octet-stream)
2006-01-22 14:05 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2006-01-22 14:04:19 UTC
I just tried to compile package gsl-1.7-2 from Suse Linux with a recent
GNU C compiler version 4.2 snapshot 20060121. 

The compiler snapshot said

/home/dcb/gnu/42-20060121/results/bin/gcc -g -O3 -Wall -fmessage-length=0 -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -O3 -finline-limit=720 --param max-inline-insns-auto=160 -ffast-math -funroll-loops -fno-strict-aliasing -momit-leaf-frame-pointer -funit-at-a-time -ftree-vectorize -c bessel_Kn.c  -fPIC -DPIC -o bessel_Kn.o
bessel_Kn.c: In function sel_Kn.c:103: internal compiler error: in vect_recog_dot_prod_pattern, at tree-vect-patterns.c:246
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

It seems that the flags -O2  -ffast-math -ftree-vectorize are required.

Preprocessed source code attached.
Comment 1 David Binderman 2006-01-22 14:05:44 UTC
Created attachment 10703 [details]
c source code
Comment 2 Andrew Pinski 2006-01-23 18:28:20 UTC
Reducing.
Comment 3 Andrew Pinski 2006-01-23 18:37:52 UTC
Reduced testcase:
double bessel_Kn_scaled_small_x(int n, double x)
{
  int k;
  double y = 0.25 * x * x;
  double ex = exp(x);
  double k_term;
  double term1, sum1, ln_pre1;
  double term2, sum2, pre2;
  for(k=1; k<=n-1; k++)
  {
    k_term *= -y/(k * (n-k));
    sum1 += k_term;
  }
  term1 = 0.5 * exp(ln_pre1) * sum1;
  return ex * (term1 + term2);
}
Comment 4 Andrew Pinski 2006-01-23 18:42:36 UTC
Further reduced:
double bessel_Kn_scaled_small_x(int n)
{
  int k;
  double k_term, sum1;
  for(k=1; k<=n-1; k++)
  {
    k_term *= -1/(k * (n-k));
    sum1 += k_term;
  }
  return sum1;
}
Comment 5 Dorit Naishlos 2006-01-24 09:10:29 UTC
Patch:

Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c        (revision 109954)
+++ tree-vect-patterns.c        (working copy)
@@ -243,7 +243,8 @@
   gcc_assert (stmt);
   stmt_vinfo = vinfo_for_stmt (stmt);
   gcc_assert (stmt_vinfo);
-  gcc_assert (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_loop_def);
+  if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_loop_def)
+    return NULL;
   expr = TREE_OPERAND (stmt, 1);
   if (TREE_CODE (expr) != MULT_EXPR)
     return NULL;
Comment 6 Andrew Pinski 2006-01-24 15:26:56 UTC
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01621.html
Comment 7 dorit 2006-01-29 16:50:09 UTC
Subject: Bug 25911

Author: dorit
Date: Sun Jan 29 16:50:05 2006
New Revision: 110377

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110377
Log:
        PR tree-opt/25911
        * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Change assert
        to an if check.


Added:
    trunk/gcc/testsuite/gcc.dg/vect/fast-math-vect-pr25911.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-patterns.c

Comment 8 Andrew Pinski 2006-01-29 17:06:41 UTC
Fixed.