This is the mail archive of the mailing list for the glibc 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: [PATCH] Fix memory leak in printf_positional

On Sat, 29 Aug 2015, Paul Pluzhnikov wrote:

> It doesn't take very long: all I needed is a printf invocation with >=
> 65536 / 3 / sizeof(void*) arguments.
> Writing such invocation by hand is of course toublesome, plumbing
> Makefile to generate it for me, and figuring out why it doesn't work
> is what takes time :-(

Normally such invocations would be generated with macros, e.g.

#define A a, a, a, a, a, a, a, a, a, a
#define B A, A, A, A, A, A, A, A, A, A

etc., unless the sort of expansion you require is unsuited to that for 
some reason.

> In addition, there is a GCC regression: compiling a printf call with
> 2800 arguments takes 4.8.4-2ubuntu1~14.04 0.06s without optimization,
> 0.86s with -O2. Same numbers for current GCC trunk (@r227321): 0.06s
> and  4m46s. This is on a very recent and fast PC. I expect there could
> be PCs in current use where the time will be 3x longer.

To me this suggests building the test with -O0 (or -fno-<something>, if 
the responsible optimization has been identified and can be disabled that 
way), with a comment in the Makefile pointing to the GCC bug and naming a 
GCC version as of which it appears (and a version as of which it is fixed, 
if applicable).

Joseph S. Myers

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