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: [RFC] fix bootstrap on aarch64-*-freebsd and probably others


On Mon, Jan 23, 2017 at 06:42:15PM +0100, Andreas Tobler wrote:
> Something like below?
> 
> If ok, I can commit, right?
> 
> Thanks,
> 
> Andreas
> 
> 2017-01-23  Andreas Tobler  <andreast@gcc.gnu.org>
> 
> 	* config/aarch64/aarch64.c (aarch64_elf_asm_constructor): Increase
> 	size of buf.
> 	(aarch64_elf_asm_destructor): Likewise.
> --- config/aarch64/aarch64.c	(revision 244819)
> +++ config/aarch64/aarch64.c	(working copy)
> @@ -5787,7 +5787,11 @@
>    else
>      {
>        section *s;
> -      char buf[18];
> +      /* The size of the buf must be big enough to hold the string and the
> +         full integer size of priority. Otherwise we will get a warning
> +         about format-truncation.
> +      */

Please put the */ on the same line as about format-truncation, like:
         about format-truncation.  */
After . there should be 2 spaces rather than one.
Also, the comment doesn't tell the truth, the buffer doesn't have to be that
big, because we know priority is bounded, just the compiler doesn't know
that.  So perhaps:
      /* While priority is known to be in range [0, 65535], so 18 bytes
	 would be enough, the compiler might not know that.  To avoid
	 -Wformat-truncation false positive, use a larger size.  */
      char buf[23];
or so?

	Jakub


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