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 tree-optimization/57156] miscompilation of call to _mm_cmpeq_epi8(a, a) or _mm_comtrue_epu8(a, a) with uninitialized a


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

Matthias Kretz <kretz at kde dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization

--- Comment #7 from Matthias Kretz <kretz at kde dot org> 2013-05-03 14:13:30 UTC ---
(In reply to comment #6)
> The standard says that using uninitialized variables invoke undefined
> behavior.

Is this Â4.1p1: Lvalue-to-rvalue conversion?
"[...] if the object is uninitialized, a program that necessitates this
conversion has undefined behavior"

> That doesn't magically exclude types that are not explicitely
> covered by the standard.

True.

> You cannot translate optimized assembler back to C in this way.
> 
> Well, you can.  Sth like
> 
>  register int a asm("eax");
>  int zero = a ^ a;
> 
> should do it.

Interesting. But then I'd rather use:
 int a;
 asm("xor %0,%0":"=r"(a));
so that GCC can determine what register to use. I wanted to avoid this, though.
Because with inline asm I expect that the compiler does not know how cheap this
call really is.

Still, I'm wondering how _mm_comtrue_epu8 is meant to be used. The intrinsic
returns 11...1 independent of the input. It shouldn't have any arguments in the
first place, but it does. And just passing it anything doesn't work reliably...

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