From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: law@cygnus.com Cc: robertlipe@usa.net, ghazi@caip.rutgers.edu, egcs@egcs.cygnus.com Subject: Re: Should we create an attribute malloc for supposed aliasbenefits? Date: Thu, 30 Sep 1999 18:02:00 -0000 Message-ID: <19990907171407X.mitchell@codesourcery.com> References: <19990906170243.C11191@rjlhome.sco.com> <22850.936688821@upchuck.cygnus.com> X-SW-Source: 1999-09n/msg00252.html Message-ID: <19990930180200.esRIhbThiWaKuvNxUCTtPMSHlzpMLKubi8Ky9ZFUdYQ@z> >>>>> "Jeffrey" == Jeffrey A Law writes: Jeffrey> Mark as the resident expert, can "restrict" be used to Jeffrey> tell the aliasing code that the return value from certain Jeffrey> functions can never alias anything else in the program? I think the answer is "no, but that's OK". For example, the following code is legal C9X: int *restrict rp1; int *restrict f () { return rp1; } void f() { int *restrict rp2 = f(); } If GCC can't tell `f' from `malloc', then it must worry that the storage returned by `malloc' is actually the same memory pointed to by `rp1'. But, C9X forbids using `rp1' to access memory while `rp2' is in (dynamic) scope. Making sense? C9X committee members? -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com