Bug 15101 - Trying to use double precision SIMD vector causes: internal compiler error: in extract_bit_field, at expmed.c:1152
Summary: Trying to use double precision SIMD vector causes: internal compiler error: i...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-04-23 14:24 UTC by bert hubert
Modified: 2004-10-22 00:27 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2004-07-23 03:43:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bert hubert 2004-04-23 14:24:17 UTC
The documentation claims that gcc can write out double precision floating point
arithmetic if the hardware can't do it SIMD. 

When compiling with -O3, this results in the ICE above, when compiling without
-O, it produces bogus results.

Compiled with:
gcc -Wall -ggdb -march=pentium3 -msse simd.c -o simd -O3

Code:
typedef int v4df __attribute__ ((mode(V4DF)));
typedef int v4sf __attribute__ ((mode(V4SF)));

union dvector4
{
  v4df vect;
  double e[4];
};

union fvector4
{
  v4sf vect;
  float e[4];
};


int main()
{
  int n;
  union dvector4 a, b;

  a.e[0]=0;
  a.e[1]=10;
  a.e[2]=20;
  a.e[3]=30;

  b.e[0]=0;
  b.e[1]=0;
  b.e[2]=0;
  b.e[3]=0;
    
    
  for(n=0;n<1000;++n) {
    b.vect = b.vect + a.vect;

    /*
    b.e[0] = b.e[0] + a.e[0];
    b.e[1] = b.e[1] + a.e[1];
    b.e[2] = b.e[2] + a.e[2];
    b.e[3] = b.e[3] + a.e[3];
    */
    
  }

  //  printf("%f, %f, %f, %f\n", c.e[0], c.e[1], c.e[2], c.e[3]);
  return 0;
}
Comment 1 Andrew Pinski 2004-04-23 15:09:07 UTC
Confirmed on the mainline.
Comment 2 Wolfgang Bangerth 2004-04-23 16:07:39 UTC
Confirmed with 3.4 as well: 
-------------- 
typedef int v4df __attribute__ ((mode(V4DF))); 
 
int main() 
{ 
  v4df a, b; 
  b = b + a; 
   
  return 0; 
} 
------------------- 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -Wall -ggdb -march=pentium3 -msse 
x.c -O3 
x.c: In function `main': 
x.c:6: internal compiler error: in extract_bit_field, at expmed.c:1152 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/gcc -Wall -ggdb -march=pentium3 -msse 
x.c -O3 
x.c:1: warning: specifying vector types with __attribute__ ((mode)) is 
deprecated 
x.c:1: warning: use __attribute__ ((vector_size)) instead 
x.c: In function `main': 
x.c:6: internal compiler error: in extract_bit_field, at expmed.c:1152 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
W. 
Comment 3 Andrew Pinski 2004-07-23 03:43:19 UTC
The reduced testcase no longer fails as the code is removed before getting to RTL. Here is a better 
reduced testcase:
typedef double v4df __attribute__((vector_size(64)));

v4df main()
{
  v4df a, b;
  b = b + a;

  return b;
}
Comment 4 Andrew Pinski 2004-10-22 00:27:42 UTC
Fixed on the mainline:
: Search converges between 2004-03-01-trunk (#446) and 2004-04-01-trunk (#447).