gcc/ChangeLog:
PR ipa/98075
* cgraph.c (cgraph_node::dump): Dump decl_is_malloc flag.
* ipa-pure-const.c (propagate_malloc): Do not set malloc
attribute for void functions.
gcc/testsuite/ChangeLog:
PR ipa/98075
* g++.dg/ipa/pr98075.C: New test.
fprintf (f, " optimize_size");
if (parallelized_function)
fprintf (f, " parallelized_function");
+ if (DECL_IS_MALLOC (decl))
+ fprintf (f, " decl_is_malloc");
if (DECL_IS_OPERATOR_NEW_P (decl))
fprintf (f, " %soperator_new",
DECL_IS_REPLACEABLE_OPERATOR (decl) ? "replaceable_" : "");
funct_state l = funct_state_summaries->get (node);
if (!node->alias
&& l->malloc_state == STATE_MALLOC
- && !node->inlined_to)
+ && !node->inlined_to
+ && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (node->decl))))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Function %s found to be malloc\n",
--- /dev/null
+/* PR ipa/98075 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline" } */
+
+template <typename BS>
+class xg {
+public:
+ BS *
+ fw ()
+ {
+ return static_cast<BS *> (operator new (sizeof (BS)));
+ }
+};
+
+class zp : xg<int> {
+public:
+ __attribute__ ((always_inline)) zp ()
+ {
+ hy = xg<int>::fw ();
+ }
+
+private:
+ int *hy;
+};
+
+void
+e5 ()
+{
+ zp ix;
+}