From patchwork Fri Oct 21 21:27:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Marlier X-Patchwork-Id: 121069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 587231007D1 for ; Sat, 22 Oct 2011 08:28:13 +1100 (EST) Received: (qmail 22846 invoked by alias); 21 Oct 2011 21:28:11 -0000 Received: (qmail 22834 invoked by uid 22791); 21 Oct 2011 21:28:10 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 21:27:36 +0000 Received: by qam2 with SMTP id 2so3654316qam.20 for ; Fri, 21 Oct 2011 14:27:36 -0700 (PDT) Received: by 10.224.9.134 with SMTP id l6mr6836595qal.6.1319232456029; Fri, 21 Oct 2011 14:27:36 -0700 (PDT) Received: from d01.cs.rochester.edu (d01.cs.rochester.edu. [128.151.67.209]) by mx.google.com with ESMTPS id fk10sm16484147qab.18.2011.10.21.14.27.35 (version=SSLv3 cipher=OTHER); Fri, 21 Oct 2011 14:27:35 -0700 (PDT) Message-ID: <4EA1E3C6.5090504@gmail.com> Date: Fri, 21 Oct 2011 17:27:34 -0400 From: Patrick Marlier User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org, rth@redhat.com, aldyh@redhat.com, triegel@redhat.com Subject: [trans-mem] wrong calling convention _ITM_free with i*86 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The calling convention with i?86 (32bits) is wrong for _ITM_free (and _ITM_malloc/_ITM_calloc). Here an example: 0x08049fd2 <+251>: mov -0x14(%ebp),%eax 0x08049fd5 <+254>: call 0x804b150 <_ITM_free(void*)> Dump of assembler code for function _ITM_free(void*): 0x0804b150 <+0>: sub $0x1c,%esp 0x0804b153 <+3>: mov 0x20(%esp),%eax 0x0804b157 <+7>: test %eax,%eax 0x0804b159 <+9>: je 0x804b176 <_ITM_free(void*)+38> 0x0804b15b <+11>: mov %gs:0x28,%edx 0x0804b162 <+18>: movl $0x807fbd0,0x8(%esp) 0x0804b16a <+26>: mov %eax,0x4(%esp) 0x0804b16e <+30>: mov %edx,(%esp) 0x0804b171 <+33>: call 0x80512a0 0x0804b176 <+38>: add $0x1c,%esp 0x0804b179 <+41>: ret This regression is probably my fault when I propose to simplify attribute (r168751). I did not pay attention to ATTR_TM_REGPARM. I am really sorry about that. So either revert the change or apply the attached modification. Bootstrapped and tested on i686 with same number of errors. === gcc Summary === # of expected passes 196 # of unexpected failures 12 # of unsupported tests 1 === g++ Summary === # of expected passes 102 # of unexpected failures 26 # of unresolved testcases 3 Patrick Marlier. * builtin-attrs.def (ATTR_TMPURE_MALLOC_NOTHROW_LIST): Rename from ATTR_TM_TMPURE_MALLOC_NOTHROW_LIST attribute. (ATTR_TMPURE_NOTHROW_LIST): Added for _ITM_free. * gtm-builtins.def: Likewise. Index: builtin-attrs.def =================================================================== --- builtin-attrs.def (revision 180309) +++ builtin-attrs.def (working copy) @@ -241,9 +241,14 @@ ATTR_TM_REGPARM, ATTR_NULL, ATTR_NORETURN_NOTHROW_LIST) DEF_ATTR_TREE_LIST (ATTR_TM_CONST_NOTHROW_LIST, ATTR_TM_REGPARM, ATTR_NULL, ATTR_CONST_NOTHROW_LIST) -DEF_ATTR_TREE_LIST (ATTR_TM_TMPURE_MALLOC_NOTHROW_LIST, - ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST) +/* Same attributes used for BUILT_IN_MALLOC except with TM_PURE thrown in. */ +DEF_ATTR_TREE_LIST (ATTR_TMPURE_MALLOC_NOTHROW_LIST, + ATTR_TM_TMPURE, ATTR_NULL, ATTR_MALLOC_NOTHROW_LIST) +/* Same attributes used for BUILT_IN_FREE except with TM_PURE thrown in. */ +DEF_ATTR_TREE_LIST (ATTR_TMPURE_NOTHROW_LIST, + ATTR_TM_TMPURE, ATTR_NULL, ATTR_NOTHROW_LIST) + /* Construct a tree for a format_arg attribute. */ #define DEF_FORMAT_ARG_ATTRIBUTE(FA) \ DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG, \ Index: gtm-builtins.def =================================================================== --- gtm-builtins.def (revision 180309) +++ gtm-builtins.def (working copy) @@ -24,11 +24,11 @@ /* Memory allocation builtins. */ DEF_TM_BUILTIN (BUILT_IN_TM_MALLOC, "_ITM_malloc", - BT_FN_PTR_SIZE, ATTR_TM_TMPURE_MALLOC_NOTHROW_LIST) + BT_FN_PTR_SIZE, ATTR_TMPURE_MALLOC_NOTHROW_LIST) DEF_TM_BUILTIN (BUILT_IN_TM_CALLOC, "_ITM_calloc", - BT_FN_PTR_SIZE_SIZE, ATTR_TM_TMPURE_MALLOC_NOTHROW_LIST) + BT_FN_PTR_SIZE_SIZE, ATTR_TMPURE_MALLOC_NOTHROW_LIST) DEF_TM_BUILTIN (BUILT_IN_TM_FREE, "_ITM_free", - BT_FN_VOID_PTR, ATTR_TM_TMPURE_NOTHROW_LIST) + BT_FN_VOID_PTR, ATTR_TMPURE_NOTHROW_LIST) /* Logging builtins. */ DEF_TM_BUILTIN (BUILT_IN_TM_LOG_1, "_ITM_LU1",