[Bug tree-optimization/88372] alloc_size attribute is ignored on function pointers

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 6 08:25:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88372

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
+      /* If there is no function, look at the type of the called
+        expression in case it's been declared attribute alloc_size.  */
+      callee = gimple_call_fn (call);
+      if (callee && TREE_CODE (TREE_TYPE (callee)) == POINTER_TYPE)
+       callee = TREE_TYPE (callee);

you should alway suse gimple_call_fntype here.


More information about the Gcc-bugs mailing list