Message ID | 52AA423C.9050808@redhat.com |
---|---|
State | New |
Headers | show |
On 12/12/13 16:09, Aldy Hernandez wrote: > flags_from_decl_or_type() only handles a TYPE or DECL. Make this > explicit instead. > > I also added a check in the use in trans-mem.c, just in case. The > subsequent conditionals should take care of the TM case. > > It would be nice if Marc Glisse could provide the testcase he mentioned > was failing. Either way, the attached patch doesn't hurt. > > Tested on x86-64 Linux. > > OK? OK for the trunk. jeff
On Thu, 12 Dec 2013, Aldy Hernandez wrote: > flags_from_decl_or_type() only handles a TYPE or DECL. Make this explicit > instead. > > I also added a check in the use in trans-mem.c, just in case. The subsequent > conditionals should take care of the TM case. > > It would be nice if Marc Glisse could provide the testcase he mentioned was > failing. Either way, the attached patch doesn't hurt. The failing testcases are already in the testsuite (I don't remember which ones, but there were quite a few IIRC). If you add only the gcc_unreachable and not the other part of your patch, you should see several failures.
diff --git a/gcc/calls.c b/gcc/calls.c index 3963bc2..2226e78 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -769,6 +769,8 @@ flags_from_decl_or_type (const_tree exp) || lookup_attribute ("transaction_pure", TYPE_ATTRIBUTES (exp)))) flags |= ECF_TM_PURE; } + else + gcc_unreachable (); if (TREE_THIS_VOLATILE (exp)) { diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index b2adc3d..1603d82 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -677,7 +677,8 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p, } else if (direct_call_p) { - if (flags_from_decl_or_type (fn) & ECF_TM_BUILTIN) + if (IS_TYPE_OR_DECL_P (fn) + && flags_from_decl_or_type (fn) & ECF_TM_BUILTIN) is_safe = true; else if (replacement) {