aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-02-18 14:39:41 +0100
committerMartin Liska <mliska@suse.cz>2020-02-18 14:39:41 +0100
commit33351ff9faa21c4c1af377d661a52ac0ce366db3 (patch)
tree7d760e87a084594b68ebff4ced557ee2ffb57460 /gcc/cgraph.c
parentea0b12523d0d9a9059b5173ce9653b92ddfb284f (diff)
downloadgcc-33351ff9faa21c4c1af377d661a52ac0ce366db3.zip
gcc-33351ff9faa21c4c1af377d661a52ac0ce366db3.tar.gz
gcc-33351ff9faa21c4c1af377d661a52ac0ce366db3.tar.bz2
Drop MALLOC attribute for void functions.
PR ipa/93583 * cgraph.c (cgraph_node::verify_node): Verify MALLOC attribute and return type of functions. * ipa-param-manipulation.c (ipa_param_adjustments::adjust_decl): Drop MALLOC attribute for void functions. * ipa-pure-const.c (funct_state_summary_t::duplicate): Drop malloc_state for a new VOID clone. PR ipa/93583 * gcc.dg/ipa/pr93583.c: New test.
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index c420863..9f0774f 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3374,6 +3374,13 @@ cgraph_node::verify_node (void)
error ("calls_comdat_local is set outside of a comdat group");
error_found = true;
}
+ if (DECL_IS_MALLOC (decl)
+ && !POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
+ {
+ error ("malloc attribute should be used for a function that "
+ "returns a pointer");
+ error_found = true;
+ }
for (e = indirect_calls; e; e = e->next_callee)
{
if (e->aux)