In case it helps define this problem at all
I have discovered that the only optimization
flag that fixes the problem at -O2 is...
gcc -O2 -fno-rerun-cse-after-loop weak.c
for..
#include <stdio.h>
extern void *foo __attribute__ ((__weak__));
main ()
{
printf ("foo: %p\n", &foo == NULL ? NULL : foo);
}
Jack