------- Comment #4 from jakub at gcc dot gnu dot org  2007-05-29 10:40 -------
When using gcc-3.2.3 as bootstrap compiler, i386.c is miscompiled
with -O0 -fkeep-inline-functions (the latter option is what is new
in gcc 4.2 and why 4.1.x bootstrap didn't suffer from this, see
2006-07-04  Eric Botcazou  <[EMAIL PROTECTED]>

        PR bootstrap/18058
        * configure.in: Add -fkeep-inline-functions to CFLAGS for stage 1
        if the bootstrap compiler is a GCC version that supports it.
        * configure: Regenerate.
).

typedef struct rtx_def *rtx;
enum machine_mode
{
  VOIDmode = 0,
  DImode = 13
};
extern rtx gen_rtx_CONST_INT (enum machine_mode, long);
extern rtx gen_x86_shld_1 (rtx, rtx, rtx);
static __inline__ rtx
gen_x86_64_shld(rtx a, rtx b, rtx c)
{
  return 0;
}
extern rtx emit_insn (rtx);

void
foo (rtx *high, rtx *low, enum machine_mode mode, int count)
{
  emit_insn ((mode == DImode ? gen_x86_shld_1 : gen_x86_64_shld)
             (high[0], low[0], gen_rtx_CONST_INT (VOIDmode, count)));
}

(extracted from i386.i) is miscompiled (tested latest RHEL3 gcc-3.2.3 as well
as current branches/gcc-3_2-branch), it calls gen_x86_64_shld unconditionally.
Removing -fkeep-inline-functions (or adding asm volatile ("") into the inline
function or making gen_x86_64_shld extern instead of static inline cures this).

Now, gcc-3_2-branch is long time closed, so IMNSHO gcc-4.2+ should work around
this bug.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot org
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29382

Reply via email to