Although I don't use macOS I rigged up a version of mktime on Fedora that reproduced the problem. The bug I found doesn't have anything to do with ATTRIBUTE_COLD; it's an unportable assumption in the emacs/src/timefns.c. I installed the attached into master to fix the bug I found; please give it a try.