------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-12 00:53 ------- This is related to PR 19828 but note constant functions are are required not to read memory. We are getting to a point where we have to defined what it means to be both const and weak which seems like a werid combination. Really const means that I can pull the function out of the loop but weak means that it might not be defined, now what is this function. Really in my mind this is undefined and glibc should be fixed in that way as __pthread_internal_tsd_address is not really const because it reads memory.
Note at -O3 we get it "right" because we unswitch the loop. Now using pure instead of const gets us into PR 19828. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19917