c++ - Using _mm_loadu_si128 and what happens if the parameter points to a string less than 16 bytes ( -


is following undefined behaviour?

char s[] = "hello"; __m128i v = _mm_loadu_si128(reinterpret_cast < __mm_128i * >(s)); 

the following undefined behavior, @ least when compiling using -fsanitize=address. complains read past end of buffer. sse equivalent quietly accepted. think because sse intrinsic functions in translation unit not compiled -fsanitize=address

char s[] = "hello"; typedef __uint128_t t; t mask = ~(t(0)) >> (8 * (sizeof(t) - strlen(s))); t v = mask & *((t *)(s)); 

as use reinterpret_cast compiler loses original type information , on own. please understand me, such typecast unavoidable in situation. want emphasize responsible providing sufficient data in case of sse operations.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -