I found that compiling pcc with itself on NetBSD/i386 using the NetBSD build framework caused some kind of loop when then building something else.
I tracked the loop to the setll() function, where we have
/* Ensure that we have enough entries */
while (off >= basesz * numents)
ll = getll();
and adding printfs shows that 'off' has a massive value. This is the effect and not the cause alas.
I have traced the cause back and found that the return value of the findoff() function which is a long long (for i386) was being corrupted, as illustrated by applying the init.diff patch and running the resulting binary against the xx.c source file attached, like so
% ./ccom -Xii xx.c xx.s
findoff off 0 (0)
scalinit woff 0 (0)
findoff off 32 (20)
scalinit woff 137438953504 (2000000020)
This is clearly wrong, and the init.i file attached is the preprocessed init.c file which caused this. Compiling that with "pcc -O2 -fstack-protector -S init.i" shows that the generated code dealing with the findoff() return value is suspect.
; woff = findoff();
; if (idebug > 0) fprintf(stderr, "scalinit woff %lld (%llx)\n", woff, woff);
addl $24, %esp
..as it wanted woff to be stored in %esi/%ebx but used %ebx as a scratch register and ends up with MSL/LSL being the same..