This is the mail archive of the libc-alpha@sourceware.org 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 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


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