calls.c (special_function_p): Remove `realloc' and add `strdup' to the list of functi...
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 30 Nov 1999 23:55:26 +0000 (23:55 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 30 Nov 1999 23:55:26 +0000 (23:55 +0000)
        * calls.c (special_function_p): Remove `realloc' and add `strdup'
        to the list of functions which have attribute malloc by default.

From-SVN: r30731

gcc/ChangeLog
gcc/calls.c

index e0a454bbf7d6d29d8c363de95c8b7789fae17bad..598369ff2285ff1430d09d827bf0e9d9fe840973 100644 (file)
@@ -1,3 +1,8 @@
+1999-11-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * calls.c (special_function_p): Remove `realloc' and add `strdup'
+       to the list of functions which have attribute malloc by default.
+
 1999-11-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * c-lex.c (yylex): With -Wtraditional, when the ANSI type of an
index d8805955a852d920f7d5b0743b9feccb878d097e..361c8b78be68e6bee04912e1af9b2f1e862d7a62 100644 (file)
@@ -607,10 +607,12 @@ special_function_p (name, fndecl, returns_twice, is_longjmp,
               && ! strcmp (tname, "longjmp"))
        *is_longjmp = 1;
       /* Do not add any more malloc-like functions to this list,
-        instead mark as malloc functions using the malloc attribute.  */
+         instead mark them as malloc functions using the malloc attribute.
+         Note, realloc is not suitable for attribute malloc since
+         it may return the same address across multiple calls. */
       else if (! strcmp (tname, "malloc")
               || ! strcmp (tname, "calloc")
-              || ! strcmp (tname, "realloc")
+              || ! strcmp (tname, "strdup")
               /* Note use of NAME rather than TNAME here.  These functions
                  are only reserved when preceded with __.  */
               || ! strcmp (name, "__vn")       /* mangled __builtin_vec_new */