Simon Kagstrom writes: > At Tue, 22 Aug 2006 15:27:14 +0100, > Andrew Haley wrote: > > I see this: > > > > static inline int > > puts (const char *string) > > { > > register unsigned long __v0 asm ("$2"); > > __asm__ volatile (".set push\n.set noreorder\n"); > > if (__builtin_constant_p (string)) > > { > > __asm__ volatile (".long 0xfffd0000\n" ".long %0\n"::"i,!r" (string)); > > } > > else > > { > > __asm__ volatile (".short 0xfffe\n" ".short %0\n"::"r" (string)); > > }; > > __asm__ volatile (".short 0xffff\t#" "puts" "\n\t" > > ".short %1\n":"=&r" (__v0):"i" (1)); > > __asm__ volatile (".set\tpop\n"); > > return (int) __v0; > > }; > > > > and it's pretty clear that string is not a constant in the context of > > this function: it's a parameter. > > I don't see why that would be a problem: I know. :-) > the function is inlined after all. Also, I've tried the same with > exit (defined in the same way, but takes an integer), that works as > expected. It's a metter of _when_ the function gets inlined. If __builtin_constant_p is folded before the function is inlined then it'll return zero. If the constant doesn't happen to get propagated it'll return zero. C'est la vie. > The funny thing is that GCC realizes that it can put the constant > address in the inline assembly with the "i,!r" constraint, but that > __builtin_constant_p still returns 0. This is what I think looks > inconsistent. Does it work if you make the whole thing a macro? Andrew.