This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] fix bootstrap on aarch64-*-freebsd and probably others
On Fri, Jan 20, 2017 at 01:37:13PM -0700, Jeff Law wrote:
> > > Which is best will depend on what the front/mid ends might have done to
> > > apply the documented limit.
> >
> > Here I know not enough to give a decision. In tree the priority_type is
> > unsigned short. In varasm priority is an int.
> >
> > Similar functions, like arm_elf_asm_cdtor, do use the sprintf instead of
> > snprintf. They theoretically have the same issue.
> >
> > So, either:
> > 2.) use %.5hu in snprintf
> > or
> > 3.) cast priority in snprintf to (unsigned short)
> I'd go with #2. I think #3 still requires range propagation to avoid the
> false positive.
I actually think 1.) is best work-around, after 18 bytes there will be some
padding so 23 bytes will almost always eat the same amount of stack space,
and we avoid actually adding some instruction to cast it or hoping all the
libcs we run on support %.5hu properly.
Jakub