Reproduced the issue with ICU 63 and latest ICU codes.
GoogleIssue:129070579
C should still have been automatically mapped to something else by the time it got to uloc_setDefault().
FWIW, when testing on a Ubuntu system with ICU 64.1, when settingLANG=C.UTF-8, the default locale reported by ICU was c
Ex:
(Maybe the default locale setting only does Level 1 canonicalization? I think the C → en_US_POSIX is “Level 2” canonicalization?)
Actually, I think the lack of mapping C → en_US_POSIX in ICU 64 might be due to this change: https://github.com/unicode-org/icu/pull/418
So after doing some checking it seems that “C.UTF-8” no longer maps to “en_US_POSIX” as of ICU 64, yet “C” by itself does still map to “en_US_POSIX”. I filed a separate bug (ICU-20575) since it seems odd that it is no longer consistent.
FWIW, I believe that ICU-20575 likely exacerbated this issue, by causing users with a “C.UTF-8” setting to inadvertently have a default locale of root.