From link.c:
int findNoMainError(int fd)
{
static const char nmeErrorMessage[] =
#if __APPLE__
"\"__Dmain\", referenced from:"
#else
"undefined reference to `_Dmain'"
#endif
;
FILE *stream = fdopen(fd, "r");
if (stream == NULL) return -1;
const size_t len = 64 * 1024 - 1;
char buffer[len + 1]; // + '\0'
size_t beg = 0, end = len;
Buffer is object of automatic lifetime, and it is not initialized, hence it effectively contains 64 garbage from stack, which may potentially corrupt data.
Comment #1 by maxim — 2013-06-11T13:52:17Z
Actually it is initialized later, but not fully and code in loop references data after position fulled by fread() which leads to garbage debug printfs.
Comment #2 by github-bugzilla — 2013-06-12T02:19:30Z