Commit 3425638a by James A. Morrison

c-common.c (handle_malloc_atttribute): Only set DECL_IS_MALLOC if the function…

c-common.c (handle_malloc_atttribute): Only set DECL_IS_MALLOC if the function returns a pointer type.

2005-04-06  James A. Morrison  <phython@gcc.gnu.org>

        * c-common.c (handle_malloc_atttribute): Only set DECL_IS_MALLOC if
        the function returns a pointer type.

From-SVN: r97751
parent 53ae8e14
2005-04-06 James A. Morrison <phython@gcc.gnu.org>
* c-common.c (handle_malloc_atttribute): Only set DECL_IS_MALLOC if
the function returns a pointer type.
2005-04-06 Daniel Berlin <dberlin@dberlin.org> 2005-04-06 Daniel Berlin <dberlin@dberlin.org>
* params.def (PARAM_SALIAS_MAX_IMPLICIT_FIELDS): New * params.def (PARAM_SALIAS_MAX_IMPLICIT_FIELDS): New
......
...@@ -4808,9 +4808,9 @@ static tree ...@@ -4808,9 +4808,9 @@ static tree
handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args), handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args),
int ARG_UNUSED (flags), bool *no_add_attrs) int ARG_UNUSED (flags), bool *no_add_attrs)
{ {
if (TREE_CODE (*node) == FUNCTION_DECL) if (TREE_CODE (*node) == FUNCTION_DECL
&& POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
DECL_IS_MALLOC (*node) = 1; DECL_IS_MALLOC (*node) = 1;
/* ??? TODO: Support types. */
else else
{ {
warning ("%qE attribute ignored", name); warning ("%qE attribute ignored", name);
......
2005-04-06 James A. Morrison <phython@gcc.gnu.org>
* gcc.dg/15443-1.c: New test.
* gcc.dg/15443-2.c: Likewise.
2005-04-06 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> 2005-04-06 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/pr15754.f90: Change annotations to dg-error. * gfortran.dg/pr15754.f90: Change annotations to dg-error.
......
/* { dg-do compile } */
void f () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */
int main ()
{
/* This used to cause an ICE. */
f ();
}
/* { dg-do compile } */
struct foo {
int bar;
};
typedef struct foo* bar;
void f () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */
int g () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */
int* h () __attribute__ ((__malloc__));
void* i () __attribute__ ((__malloc__));
struct foo j () __attribute__ ((__malloc__)); /* { dg-warning "ignored" } */
struct foo* k () __attribute__ ((__malloc__));
bar l () __attribute__((malloc));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment