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++/15795] Strange bug / incorrect code generation with SSE


------- Additional Comments From bangerth at dealii dot org  2004-06-03 17:33 -------
Andrew, though you may be right, gcc's behavior doesn't make much sense. 
The compiler knows the alignment requirements of such objects, and if it 
does not satisfy them in any way, then we can't say we support them since 
there is no way (except for using stack variables) in which one can write 
code that actually works. 
 
There must be some way, at least with using operator new, to allocate 
this space with the alignment requirements of such types. 
 
I'd like either Jan or one of the people with knowledge of the interface 
between C++ and libstdc++'s implementation of operator new to comment 
on this. 
 
In short, for latecomers: this program segfaults: 
---------------- 
#include <xmmintrin.h> 
 
int main() { 
  __m128 * foo = new __m128; 
  *foo = _mm_setzero_ps(); 
} 
---------------- 
Andrew claims that it is because of the pointer returned by malloc doesn't 
satisfy the alignment criteria for this data type. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bkoz at gcc dot gnu dot org,
                   |                            |jason at gcc dot gnu dot
                   |                            |org, nathan at gcc dot gnu
                   |                            |dot org, hubicka at gcc dot
                   |                            |gnu dot org
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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