This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/59149] New: diagnose_tm_1 calls flags_from_decl_or_type on an ADDR_EXPR
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 Nov 2013 18:45:09 +0000
- Subject: [Bug tree-optimization/59149] New: diagnose_tm_1 calls flags_from_decl_or_type on an ADDR_EXPR
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59149
Bug ID: 59149
Summary: diagnose_tm_1 calls flags_from_decl_or_type on an
ADDR_EXPR
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
(I haven't seen a category for transactional memory)
In trans-mem.c, function diagnose_tm_1 has:
if (flags_from_decl_or_type (fn) & ECF_TM_BUILTIN)
earlier, it tries:
if (TREE_CODE (fn) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL)
{
direct_call_p = true;
replacement = TREE_OPERAND (fn, 0);
replacement = find_tm_replacement_function (replacement);
if (replacement)
fn = replacement;
}
which in many cases leaves the ADDR_EXPR in fn.
I believe flags_from_decl_or_type shouldn't be called with anything other than
a decl or a type and we could add an assertion in there. If you disagree, feel
free to close the PR. I noticed this because it broke a local patch of mine
where I added code to flags_from_decl_or_type that didn't like ADDR_EXPR.