This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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: unassigned@gcc.gnu.org
        ReportedBy: cjxgm@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ââââââââââââââââââââââââââââââââââââââââââââââââââââââ
âeax            0xb7d29008       -1210937336                                  
â
âecx            0x101000 1052672                                              
â
âedx            0xb7d29008       -1210937336                                  
â
âebx            0xb7fd8000       -1208123392                                  
â
âesp            0xbffff370       0xbffff370                                   
â
âebp            0xbffff3a8       0xbffff3a8                                   
â
âesi            0x0      0                                                    
â
âedi            0x0      0                                                    
â
âeip            0x804842a        0x804842a <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>     mov    0x2c(%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: main                            Line: ??   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)"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]