public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fix profiledbootstrap with -Werror=format-length (77753)
@ 2016-09-27 19:34 Martin Sebor
  2016-09-28  4:41 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Sebor @ 2016-09-27 19:34 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

The attached one line patch increases a local buffer size to
avoid an apparently justified (though in reality likely a false
positive) -Wformat-length warning in varasm.c.  The warning has
been reported to break profiledbootstrap on powerp64le (though
not ordinary bootstrap).

An arguably better solution would be to explicitly constrain
the range of the integer variable to that of valid priority values.
Unfortunately, as pointed out in bug 77721, due to the limitation
of the current VRP implementation, this isn't always reliable.

Martin

[-- Attachment #2: gcc-77753.diff --]
[-- Type: text/x-patch, Size: 786 bytes --]

PR bootstrap/77753 - [7 Regression] broken profiledbootstrap due to
	-Werror=format-length in varasm.c:1573

gcc/ChangeLog:
2016-09-27  Martin Sebor  <msebor@redhat.com>

	PR bootstrap/77753
	* varasm.c (assemble_addr_to_section): Increase local buffer size.

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 240556)
+++ gcc/varasm.c	(working copy)
@@ -1556,7 +1556,9 @@ assemble_addr_to_section (rtx symbol, se
 section *
 get_cdtor_priority_section (int priority, bool constructor_p)
 {
-  char buf[16];
+  /* Buffer conservatively large enough for the full range of a 32-bit
+     int plus the text below.  */
+  char buf[18];
 
   /* ??? This only works reliably with the GNU linker.  */
   sprintf (buf, "%s.%.5u",

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix profiledbootstrap with -Werror=format-length (77753)
  2016-09-27 19:34 [PATCH] fix profiledbootstrap with -Werror=format-length (77753) Martin Sebor
@ 2016-09-28  4:41 ` Jeff Law
  2016-09-28 20:58   ` Martin Sebor
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2016-09-28  4:41 UTC (permalink / raw)
  To: Martin Sebor, Gcc Patch List

On 09/27/2016 01:30 PM, Martin Sebor wrote:
> The attached one line patch increases a local buffer size to
> avoid an apparently justified (though in reality likely a false
> positive) -Wformat-length warning in varasm.c.  The warning has
> been reported to break profiledbootstrap on powerp64le (though
> not ordinary bootstrap).
>
> An arguably better solution would be to explicitly constrain
> the range of the integer variable to that of valid priority values.
> Unfortunately, as pointed out in bug 77721, due to the limitation
> of the current VRP implementation, this isn't always reliable.
>
> Martin
>
> gcc-77753.diff
>
>
> PR bootstrap/77753 - [7 Regression] broken profiledbootstrap due to
> 	-Werror=format-length in varasm.c:1573
>
> gcc/ChangeLog:
> 2016-09-27  Martin Sebor  <msebor@redhat.com>
>
> 	PR bootstrap/77753
> 	* varasm.c (assemble_addr_to_section): Increase local buffer size.
OK.

WRT 77721, could you add that test to the testsuite, but xfailed?

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix profiledbootstrap with -Werror=format-length (77753)
  2016-09-28  4:41 ` Jeff Law
@ 2016-09-28 20:58   ` Martin Sebor
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Sebor @ 2016-09-28 20:58 UTC (permalink / raw)
  To: Jeff Law, Gcc Patch List

On 09/27/2016 10:38 PM, Jeff Law wrote:
> On 09/27/2016 01:30 PM, Martin Sebor wrote:
>> The attached one line patch increases a local buffer size to
>> avoid an apparently justified (though in reality likely a false
>> positive) -Wformat-length warning in varasm.c.  The warning has
>> been reported to break profiledbootstrap on powerp64le (though
>> not ordinary bootstrap).
>>
>> An arguably better solution would be to explicitly constrain
>> the range of the integer variable to that of valid priority values.
>> Unfortunately, as pointed out in bug 77721, due to the limitation
>> of the current VRP implementation, this isn't always reliable.
>>
>> Martin
>>
>> gcc-77753.diff
>>
>>
>> PR bootstrap/77753 - [7 Regression] broken profiledbootstrap due to
>>     -Werror=format-length in varasm.c:1573
>>
>> gcc/ChangeLog:
>> 2016-09-27  Martin Sebor  <msebor@redhat.com>
>>
>>     PR bootstrap/77753
>>     * varasm.c (assemble_addr_to_section): Increase local buffer size.
> OK.
>
> WRT 77721, could you add that test to the testsuite, but xfailed?

Sure.  Done in r240595.

Martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-28 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27 19:34 [PATCH] fix profiledbootstrap with -Werror=format-length (77753) Martin Sebor
2016-09-28  4:41 ` Jeff Law
2016-09-28 20:58   ` Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).