[Bug c/56375] New: SIGSEGV when assign SIMD variable to member of allocated structure

2013-02-18 Thread cjxgm at 126 dot com

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56375

 Bug #: 56375
   Summary: SIGSEGV when assign SIMD variable to member of
allocated structure
Classification: Unclassified
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: cj...@126.com


The code:

#include malloc.h
typedef float v4 __attribute__((vector_size(sizeof(float)*4)));
typedef struct IpuImage
{
v4 data[256*256];
}
IpuImage;
int main()
{
IpuImage * I = malloc(sizeof(IpuImage));
v4 color = {1, 0, 1, 0};
I-data[0] = color;
return 0;
}

I use this to compile:
gcc -o a a.c -std=gnu11 -march=native

SIGSEGV happens at I-data[0] = color
Then I tried to debug in assembly mode, following is the gdb's output:

┌──Register group:
general─┐
│eax0xb7d29008   -1210937336  
│
│ecx0x101000 1052672  
│
│edx0xb7d29008   -1210937336  
│
│ebx0xb7fd8000   -1208123392  
│
│esp0xb370   0xb370   
│
│ebp0xb3a8   0xb3a8   
│
│esi0x0  0
│
│edi0x0  0
│
│eip0x804842a0x804842a main+46  
│
│eflags 0x210282 [ SF IF RF ID ]  
│
 cs 0x73 115  
│
│ss 0x7b 123  
│
└──┘
   │0x8048411 main+21 mov%eax,0x2c(%esp)
│
   │0x8048415 main+25 movaps 0x80484e0,%xmm0
│
   │0x804841c main+32 movaps %xmm0,0x10(%esp)   
│
   │0x8048421 main+37 mov0x2c(%esp),%eax
│
   │0x8048425 main+41 movaps 0x10(%esp),%xmm0   
│
  │0x804842a main+46 movaps %xmm0,(%eax)   
│
   │0x804842d main+49 mov$0x0,%eax  
│
   │0x8048432 main+54 leave 
│
   │0x8048433 main+55 ret   
│
   │0x8048434   xchg   %ax,%ax
│
   │0x8048436   xchg   %ax,%ax
│
   │0x8048438   xchg   %ax,%ax
│
   │0x804843a   xchg   %ax,%ax
│
  
└───┘
child process 7781 In: mainLine: ??   PC: 0x804842a 
(gdb) ni
0x08048402 in main ()
0x08048405 in main ()
0x0804840c in main ()
0x08048411 in main ()
0x08048415 in main ()
0x0804841c in main ()
0x08048421 in main ()
0x08048425 in main ()
0x0804842a in main ()

Program received signal SIGSEGV, Segmentation fault.
0x0804842a in main ()
(gdb) 

%eax is non-zero, showing that malloc succeeded, and SIGSEGV is occured at
movaps %xmm0,(%eax)


[Bug c/56120] New: built-in SIMD with statement expression causes ICE: in iterative_hash_expr, at tree.c:6990 when optimization is on

2013-01-26 Thread cjxgm at 126 dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56120



 Bug #: 56120

   Summary: built-in SIMD with statement expression causes ICE: in

iterative_hash_expr, at tree.c:6990 when optimization

is on

Classification: Unclassified

   Product: gcc

   Version: 4.7.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: cj...@126.com

Target: i686-pc-linux-gnu

 Build: /build/src/gcc-4.7.2/configure --prefix=/usr

--libdir=/usr/lib --libexecdir=/usr/lib

--mandir=/usr/share/man --infodir=/usr/share/info

--with-bugurl=https://bugs.archlinux.org/

--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c

++ --enable-shared --ena





The following is the code:



typedef float v4 __attribute__((vector_size(sizeof(float)*4)));

v4 v4refract(v4 n, v4 v, float ior)

{

 return n * ({ v4 __t = (n) * (v); __t[0] + __t[1] + __t[2]; });

}



the compiler output:

$ gcc -msse -O3 -c -o v.o v.c

v.c: In function 'v4refract':

v.c:5:11: internal compiler error: in iterative_hash_expr, at tree.c:6990

Please submit a full bug report,

with preprocessed source if appropriate.

See https://bugs.archlinux.org/ for instructions.



Compilation succeeds when the optimization level is 0

but if the optimization level is above 0, whatever 1, 2 or 3, produces this

ICE.