From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11805 invoked by alias); 11 Dec 2013 18:24:29 -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 11746 invoked by uid 48); 11 Dec 2013 18:24:25 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/59470] [4.8 Regression] libstdc++ miscompilation after r205709 Date: Wed, 11 Dec 2013 18:24:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg01006.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59470 --- Comment #8 from Jakub Jelinek --- So, debugging and inspection shows that it is the _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE12_M_group_intEPKcjcRSt8ios_basePcS9_Ri call in the _M_insert_int method that gets bogus arguments, in particular the __new argument for it, which is supposed to be what the second alloca returned plus 2, has the same value as the next argument __cs, both are set to the result of the first alloca + 20 - __len (8 on this testcase). In the assembly one can easily see it: movl %ecx, 28(%esp) movl -84(%ebp), %ecx movl %edx, 24(%esp) <--- here, correct value movl %edx, 20(%esp) <--- here, incorrect value movsbl 37(%edi), %edx movl %eax, 8(%esp) movl %ecx, 4(%esp) movl -72(%ebp), %ecx movl %edx, 12(%esp) movl %ecx, (%esp) call _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE12_M_group_intEPKcjcRSt8ios_basePcS9_Ri@PLT