This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Builtin strcpy/strncpy/memcpy/strcmp/fputs fixes and optimizations


 > From: Jakub Jelinek <jakub@redhat.com>
 > 
 > fputs ("foobar" + (i++ & 3), f) and miscompile
 > 
 > To sum up, c_getstr guarantees the argument is constant string with constant
 > length without side effects if returning non-NULL, while c_strlen does not
 > (I think it just guarantees that if it returns an INTEGER_CST that it does
 > not have side effects).

I want to make sure I understand this.  The c_strlen() function won't
return an INTEGER_CST for the fputs() case above but *will* return a
non-NULL tree expr which corresponds to "6 - (i++ & 3)", right?
That's why you have to check whether its an INTEGER_CST or prefer
c_getstr?

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]