From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16859 invoked by alias); 3 May 2013 12:27:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16796 invoked by uid 48); 3 May 2013 12:27:05 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/57156] miscompilation of call to _mm_cmpeq_epi8(a, a) or _mm_comtrue_epu8(a, a) with uninitialized a Date: Fri, 03 May 2013 12:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg00205.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57156 --- Comment #6 from Richard Biener 2013-05-03 12:27:05 UTC --- (In reply to comment #5) > (In reply to comment #4) > > I wouldn't know how to counter this for the _mm_cmpeq_epi8 case > > Actually, I have yet to find something in the standard that says using an > uninitialized __m128 is undefined behavior. ;) > Thus the only standard that would define the rules here would be Intel's, no? > And from reading their docs I understand that calling an intrinsics maps to the > behavior you'd get when using the associated instruction. In this case > comparing any XMM register with itself will result in what I expect. The standard says that using uninitialized variables invoke undefined behavior. That doesn't magically exclude types that are not explicitely covered by the standard. Doing int a; _Bool true = a == a; is undefined as well, so is int a; int zero = a ^ a; 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.