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]
Other format: [Raw text]

Re: Bug in expand_builtin_sprintf


On Wed, 10 Oct 2007, Jakub Jelinek wrote:

> > > Testcase please?
> >
> > I don't have one, unfortunately. I spotted this by looking at the code.
> > I believe the only consequence is that the simplifications are never
> > done in expand_builtin_sprintf.
>
> I guess the reproducer would need to make the fmt string visible to
> fold_builtin only during loop optimizations or later (certainly after fab
> pass) and then expand_builtin_sprintf could do this optimization.
> 	Jakub

While you're at it, IMHO there's some unnecessary code duplication here.
We should have expand_builtin_sprintf call fold_builtin_sprintf instead of
having it's own copy of the transformation code.  (This wouldn't have
prevented the bug you found, because you still have to pull out the args
in the expand_ version before you call the fold_ one.  But still... it'll
get even worse as you add more opts.)

You have to be careful to make sure the code is actually the same.  If
either version does something different, figure out why and try to
reconcile them.  In the past I believe we've found cases where one did
more and/or different opts than the other and they needed to be merged.

See most of the the expand_builtin_str* functions for examples of what I
mean.  If you would please do this and queue it up for stage1, I would
much appreciate it.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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