[PATCH] Fix memory leak in printf_positional

Martin Sebor msebor@gmail.com
Sat Sep 12 19:42:00 GMT 2015


On 09/12/2015 01:22 PM, Paul Pluzhnikov wrote:
> On Sat, Sep 12, 2015 at 12:16 PM, Martin Sebor <msebor@gmail.com> wrote:
>
>> I see the test disables optimization to work around the GCC issue
>> but I wonder if a better solution might be to create an array object
>> for the format string rather than passing it as a literal to printf.
>
> You mean like this:
>
>    char fmt[] = "%$1s %$2s ...";
>    printf(fmt, "a", "a", ...);
>
> If so, no: the format literal is not what triggers the the GCC problem
> -- the number of arguments being passed to printf does.

I see. Thanks for clarifying that.

FWIW, I asked because I noticed other tests that take quite long
to compile (besides stressing the compiler in other ways) and I'd
like to get a sense of what constructs in the test suite tend to
trigger these types of problems and try to come up with alternate
approaches that avoid such problems.

But in this instance, if it's the arguments, I don't see a better
way around it than to disable optimization.

Martin



More information about the Libc-alpha mailing list