https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78787
--- Comment #4 from David Malcolm ---
(In reply to David Malcolm from comment #3)
> Created attachment 40343 [details]
> Hack to debug diagnostic-color.c
$ ./xgcc -B. -O2 -Wall -Wextra -flto /home/david/coding-3/gcc-git-clean/src/z.c
should_colorize: true (isatty (stderr))
should_colorize: true (isatty (stderr))
/home/david/coding-3/gcc-git-clean/src/z.c: In function ‘main’:
/home/david/coding-3/gcc-git-clean/src/z.c:3:27: warning: unused parameter
‘argv’ [-Wunused-parameter]
int main (int argc, char *argv[])
^~~~
should_colorize: false (!isatty (stderr))
should_colorize: false (!isatty (stderr))
should_colorize: false (!isatty (stderr))
should_colorize: false (!isatty (stderr))
/home/david/coding-3/gcc-git-clean/src/z.c: In function ‘main’:
/home/david/coding-3/gcc-git-clean/src/z.c:5:3: warning: ‘__builtin_strcpy’
writing 4 bytes into a region of size 1 overflows the destination
[-Wstringop-overflow=]
__builtin_strcpy (d, argc < 3 ? "123" : "456789");
^
So it appears that lto's stderr is not directly connected to a tty, and hence
there's no colorization by default.