"Alan Curry" <[email protected]> writes: > Jim Meyering writes: >> >> >> The code in question is calling btowc(EOF), which uses >> this definition from wchar.h: >> >> extern wint_t __btowc_alias (int __c) __asm ("btowc"); >> extern __inline wint_t >> __NTH (btowc (int __c)) >> { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' >> ? (wint_t) __c : __btowc_alias (__c)); } >> >> Since I don't even see any code that might loop there, >> (though I didn't look up what __asm ("btowc") does) >> I'd suspect a compiler problem. > > That asm seems to be one of these: > http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Asm-Labels.html > > It's saying that the function __btowc_alias is actually to be named "btowc" > in the generated assembly code. This enables the inline function named btowc > to call an external function also named btowc, by going through that "alias". > Tricky of them!
If the compiler creates an outline definition of btowc with this body this will result in an infinite (tail-)recursion. Normally this shouldn't happen with extern inline definitions. Andreas. -- Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
