* [trans-mem] wrong calling convention _ITM_free with i*86
@ 2011-10-21 23:38 Patrick Marlier
2011-10-24 16:20 ` Aldy Hernandez
0 siblings, 1 reply; 3+ messages in thread
From: Patrick Marlier @ 2011-10-21 23:38 UTC (permalink / raw)
To: gcc-patches, rth, aldyh, triegel
[-- Attachment #1: Type: text/plain, Size: 1652 bytes --]
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
<GTM::gtm_thread::forget_allocation(void*, void (*)(void*))>
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.
[-- Attachment #2: regparm.patch --]
[-- Type: text/plain, Size: 1856 bytes --]
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",
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [trans-mem] wrong calling convention _ITM_free with i*86
2011-10-21 23:38 [trans-mem] wrong calling convention _ITM_free with i*86 Patrick Marlier
@ 2011-10-24 16:20 ` Aldy Hernandez
2011-10-24 17:09 ` Aldy Hernandez
0 siblings, 1 reply; 3+ messages in thread
From: Aldy Hernandez @ 2011-10-24 16:20 UTC (permalink / raw)
To: Patrick Marlier; +Cc: gcc-patches, rth, triegel
> Bootstrapped and tested on i686 with same number of errors.
Sorry to ask you to run more tests, but can you also test x86-64? If
there are no regressions on x86-64 either, OK.
Aldy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [trans-mem] wrong calling convention _ITM_free with i*86
2011-10-24 16:20 ` Aldy Hernandez
@ 2011-10-24 17:09 ` Aldy Hernandez
0 siblings, 0 replies; 3+ messages in thread
From: Aldy Hernandez @ 2011-10-24 17:09 UTC (permalink / raw)
To: Patrick Marlier; +Cc: gcc-patches, rth, triegel
On 10/24/11 10:40, Aldy Hernandez wrote:
>
>> Bootstrapped and tested on i686 with same number of errors.
>
> Sorry to ask you to run more tests, but can you also test x86-64? If
> there are no regressions on x86-64 either, OK.
As discussed off-line, I'll run x86-64 tests for you since you don't
have a 64-bit available.
Tests finished with no regressions. Feel free to commit.
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-24 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-21 23:38 [trans-mem] wrong calling convention _ITM_free with i*86 Patrick Marlier
2011-10-24 16:20 ` Aldy Hernandez
2011-10-24 17:09 ` Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).