This is the mail archive of the 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]

fix c/3581

I didn't reproduce the crash reported in the pr on any of my systems,
but while I was looking at the compilation-time issue, I spotted the
use of alloca.  Given that the string constructed from this test case
is about 18MB, it doesn't take a rocket scientist to figure out what

So there are two patches here, one for 3.1 that changes to use malloc
instead of alloca, and one for 3.2 that fixes the compilation time
issue.  (I couldn't imagine Mark considering this important enough
to pull the whole thing back into 3.1 at this stage.)

Concerning the 3.2 patch:

I hate chainon.  I suspect virtually every use of it is a mistake
waiting to happen.  This mostly because we have to walk the entire
list to add something to the end, making list creation needlessly
quadratic.  Failing the ability to keep track of the tail, it's
better to create the list backward and use nreverse.

The patch reduces compilation time of the PR in the test case from
~400 seconds to 72 seconds (just about none of which is in the front
end anymore).  The synthetic test case I added is even worse.  It
concatenates 100,000 copies of "a".  Before the patch, compilation
time is larger than my patience of 10 minutes.  After the patch,
compilation time is 0.31 seconds.

Tested on i686-linux.

Mark, smaller patch ok for 3.1?


Attachment: z31
Description: Text document

Attachment: z32
Description: Text document

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