Skip to content

Commit

Permalink
Add -ftree-coalesce-vars option to unit test compilation.
Browse files Browse the repository at this point in the history
This is a workaround for inefficient handling of many setjmps in gcc >= 4.9.  Setjmp is used in all error handling, but in the unit tests each test macro contains an error handling block so they add up pretty quickly for large unit tests.

Enabling -ftree-coalesce-vars in affected versions reduces build time and memory requirements by nearly an order of magnitude.  Even so, compiles are much slower than gcc <= 4.8.

We submitted a bug for this at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87316
Which was marked as a duplicate of: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63155
  • Loading branch information
dwsteele committed Sep 17, 2018
1 parent b5f749b commit e55d733
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/xml/release.xml
Expand Up @@ -121,6 +121,10 @@
<p>Make Valgrind return an error even when a non-fatal issue is detected. Update some minor issues discovered in the tests as a result.</p>
</release-item>

<release-item>
<p>Add <id>-ftree-coalesce-vars</id> option to unit test compilation.</p>
</release-item>

<release-item>
<p>Clear test directory between test runs.</p>
</release-item>
Expand Down
1 change: 1 addition & 0 deletions test/lib/pgBackRestTest/Common/JobTest.pm
Expand Up @@ -400,6 +400,7 @@ sub run
"\n" .
"test.o: test.c\n" .
"\t\$(CC) \$(CFLAGS) \$(TESTFLAGS) -O0" .
($self->{oTest}->{&TEST_VM} ne VM_U12 ? ' -ftree-coalesce-vars' : '') .
(vmCoverageC($self->{oTest}->{&TEST_VM}) && $self->{bCoverageUnit} ?
' -fprofile-arcs -ftest-coverage' : '') .
" -c test.c\n" .
Expand Down

0 comments on commit e55d733

Please sign in to comment.