This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining bug on MIPS - both 2.95.3 and 3.0 branches
> Date: Fri, 9 Mar 2001 23:46:42 -0500
> From: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
> Cc: gcc-bugs@gcc.gnu.org
> Right. Is there any way to define an inline asm in an inline function
> with an "i" constraint for an argument of the function, though? I get
> (obviously) constraint violation errors. I'm assuming this needs to
> become a macro.
It's possible that you need to try "i#*X", as in this example:
# define feraiseexcept(__excepts) \
((__builtin_constant_p (__excepts) \
&& ((__excepts) & ((__excepts)-1)) == 0 \
&& (__excepts) != FE_INVALID) \
? ((__excepts) != 0 \
? (__extension__ ({ __asm__ __volatile__ \
("mtfsb1 %s0" \
: : "i#*X"(__builtin_ffs (__excepts))); \
(void)0; })) \
: (void)0) \
: (feraiseexcept) (__excepts))
I think that inline functions make the problem more likely to happen
but it can happen anyway. (The problem being that just because the
code is guarded by '__builtin_constant_p' doesn't mean that it doesn't
get compiled, at least up to some point in the compiler, and
constraints are checked early.)
--
- Geoffrey Keating <geoffk@geoffk.org>