http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49992
--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-08-08 17:45:03 UTC --- We seem to have... /* Given a partial pathname as input, return another pathname that shares no directory elements with the pathname of __FILE__. This is used by fancy_abort() to print `Internal compiler error in expr.c' instead of `Internal compiler error in ../../GCC/gcc/expr.c'. This version is meant to be used for the gen* programs and therefor need not handle subdirectories. */ const char * trim_filename (const char *name) { static const char this_file[] = __FILE__; const char *p = name, *q = this_file; /* Skip any parts the two filenames have in common. */ while (*p == *q && *p != 0 && *q != 0) p++, q++; /* Now go backwards until the previous directory separator. */ while (p > name && !IS_DIR_SEPARATOR (p[-1])) p--; return p; } in errors.c and... /* Given a partial pathname as input, return another pathname that shares no directory elements with the pathname of __FILE__. This is used by fancy_abort() to print `Internal compiler error in expr.c' instead of `Internal compiler error in ../../GCC/gcc/expr.c'. */ const char * trim_filename (const char *name) { static const char this_file[] = __FILE__; const char *p = name, *q = this_file; /* First skip any "../" in each filename. This allows us to give a proper reference to a file in a subdirectory. */ while (p[0] == '.' && p[1] == '.' && IS_DIR_SEPARATOR (p[2])) p += 3; while (q[0] == '.' && q[1] == '.' && IS_DIR_SEPARATOR (q[2])) q += 3; /* Now skip any parts the two filenames have in common. */ while (*p == *q && *p != 0 && *q != 0) p++, q++; /* Now go backwards until the previous directory separator. */ while (p > name && !IS_DIR_SEPARATOR (p[-1])) p--; return p; } in diagnostic.c. Shouldn't we either rename one of these trim_filename subroutines or unify on a single trim_filename subroutine that is always called from libcommon.a?