https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117857
--- Comment #6 from Gleb Mazovetskiy <glex.spb at gmail dot com> --- > This has been "broken" since r0-106339-g6a0f6e7799c988 (GCC 4.6.0) Over 13 > years ago. I don't think so. GCC7 has been the version used by macports for a while, and more recently some reported compiling GCC12. Looking through the code, I'm not quite sure what could've changed to result in a regression? The only way this could've worked is if `HAVE_TTYNAME_R` wasn't defined previously, so I'm guessing it's some autoconf change? Patching this and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117834 results in a successful build.