public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19432] New: misaligned SSE-datatype
@ 2005-01-13 23:11 Pferdebert at west dot de
  2005-01-13 23:21 ` [Bug c++/19432] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: Pferdebert at west dot de @ 2005-01-13 23:11 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/19432] misaligned SSE-datatype
  2005-01-13 23:11 [Bug c++/19432] New: misaligned SSE-datatype Pferdebert at west dot de
@ 2005-01-13 23:21 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-13 23:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-13 23:20 -------
This is a dup of bug 15795, which is not a GCC bug really, this is a bug in your OS (because malloc 
requires the largest alignment for all supported data types).

*** This bug has been marked as a duplicate of 15795 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-13 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-13 23:11 [Bug c++/19432] New: misaligned SSE-datatype Pferdebert at west dot de
2005-01-13 23:21 ` [Bug c++/19432] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).