Hi. As shown in the PR, remove_prefix function is written wrongly. It does not distinguish in between a node in linked list and pprefix->plist. So I decide to rewrite it. Apart from that, I identified discrepancy in between do_add_prefix and prefix_from_string where the later one appends always DIR_SEPARATOR (if missing). So I also the former function. And I'm adding unit tests for all functions in file-find.c. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin gcc/ChangeLog: 2017-08-14 Martin Liska PR driver/81829 * file-find.c (do_add_prefix): Always append DIR_SEPARATOR at the end of a prefix. (remove_prefix): Properly remove elements and accept also path without a trailing DIR_SEPARATOR. (purge): New function. (file_find_verify_prefix_creation): Likewise. (file_find_verify_prefix_add): Likewise. (file_find_verify_prefix_removal): Likewise. (file_find_c_tests): Likewise. * selftest-run-tests.c (selftest::run_tests): Add new file_find_c_tests. * selftest.h (file_find_c_tests): Likewise. --- gcc/file-find.c | 182 ++++++++++++++++++++++++++++++++++++++++++----- gcc/selftest-run-tests.c | 1 + gcc/selftest.h | 1 + 3 files changed, 167 insertions(+), 17 deletions(-)