From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21173 invoked by alias); 19 Feb 2011 07:44:22 -0000 Received: (qmail 21143 invoked by uid 22791); 19 Feb 2011 07:44:16 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 19 Feb 2011 07:44:12 +0000 From: "xinliangli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/47812] [x32] __builtin_strlen is miscompiled at -O2 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: xinliangli at gmail dot com 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 Date: Sat, 19 Feb 2011 07:47:00 -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 X-SW-Source: 2011-02/txt/msg02231.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47812 --- Comment #2 from davidxl 2011-02-19 07:44:03 UTC --- In ix86_expand_strlen: if (GET_MODE (out) != Pmode) out = convert_to_mode (Pmode, out, 1); Here out is REG:SI 59 -- the result register for strlen. After conversion, new reg:DI 64 is created. There are two problems here: 1) the result is now 64, but the caller 'expand_builtin_strlen' still uses reg 59 2) the conversion itself generates an uninitialized use. David