public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Should we create an attribute malloc for supposed alias benefits?
@ 1999-09-06 12:40 Kaveh R. Ghazi
  1999-09-06 14:36 ` Jeffrey A Law
  1999-09-30 18:02 ` Kaveh R. Ghazi
  0 siblings, 2 replies; 12+ messages in thread
From: Kaveh R. Ghazi @ 1999-09-06 12:40 UTC (permalink / raw)
  To: egcs

I noticed the following in calls.c:

 >       /* XXX should have "malloc" attribute on functions instead
 >          of recognizing them by name.  */
 >       else if (! strcmp (tname, "malloc")
 >                || ! strcmp (tname, "calloc")
 >                || ! strcmp (tname, "realloc")
 >                /* Note use of NAME rather than TNAME here.  These functions
 >                   are only reserved when preceded with __.  */
 >                || ! strcmp (name, "__vn")       /* mangled __builtin_vec_new */
 >                || ! strcmp (name, "__nw")       /* mangled __builtin_new */
 >                || ! strcmp (name, "__builtin_new")
 >                || ! strcmp (name, "__builtin_vec_new"))
 >         *is_malloc = 1;


	It looks like `is_malloc' is used later to decide that the
return value of a malloc-like function will never alias anything else.

Would it be useful to follow the comments and create an attribute
malloc?  Then we could declare things like xmalloc/xrealloc/xcalloc
with that attribute.  (We should probably add strdup/xstrdup to that
list.)  I don't know if the alias benefits would be worth it though.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1999-09-30 18:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-06 12:40 Should we create an attribute malloc for supposed alias benefits? Kaveh R. Ghazi
1999-09-06 14:36 ` Jeffrey A Law
1999-09-06 15:03   ` Robert Lipe
1999-09-07  0:22     ` Jeffrey A Law
1999-09-07  9:05       ` Should we create an attribute malloc for supposed aliasbenefits? Mark Mitchell
1999-09-30 18:02         ` Mark Mitchell
1999-09-07 17:09       ` Mark Mitchell
1999-09-30 18:02         ` Mark Mitchell
1999-09-30 18:02       ` Should we create an attribute malloc for supposed alias benefits? Jeffrey A Law
1999-09-30 18:02     ` Robert Lipe
1999-09-30 18:02   ` Jeffrey A Law
1999-09-30 18:02 ` Kaveh R. Ghazi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).