This is my first bug I report. I hope I do everything well:   
  
If I want to use SSE-instruction I use the build-in datatype. As long as you  
only use this one everything goes well.  
If this type is am member of a class then there occures a misalignment when  
allocating this with new:  
Here is a sample code:  
  
#include <iostream>  
#include <cstdlib>  
  
typedef float V4SF __attribute__ ((mode(V4SF)));  
  
#define ALIGN16 __attribute__((aligned(16)))  
#define __class16 class __attribute__((__aligned__(16)))  
  
//ALIGN16 struct SVector //neither ALIGN16   
__class16 SVector  //nor this variant works  
{  
public:  
  V4SF v;  
};  
  
using namespace std;  
  
int main(int argc, char *argv[])  
{  
  V4SF* pv = new V4SF;  
  cout << "Alignment (that should be): " << __alignof__(V4SF) << endl;  
  cout << "Adress dividable through 16? " << unsigned(&(*pv))%16 << endl;//This 
works  
   
  SVector* ps = new SVector; 
  cout << "Alignment (that should be): " << __alignof__(SVector) << endl;  
  cout << "Adress dividable through 16? " << unsigned(&(*ps))%16 << endl;//This 
doesn't work  
  //as you can see a movaps or similar instruction will crash the System  
   
  return EXIT_SUCCESS;  
}

-- 
           Summary: misaligned SSE-datatype
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Pferdebert at west dot de
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to