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

             Bug #: 53461
           Summary: Incorrect handling of CASE_VECTOR_PC_RELATIVE in
                    config/m68k.md
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: gvvn1...@gmail.com


I have been trying to port a recent gcc version to m68k-next-nextstep3 target
and encountered an ICE in the stage1 compiler.  With help of the m68k debian
ports community I was able to identify a bug in config/m68k/m68k.md.  This bug
exists in all reasonably recent versions of gcc but not in gcc-3.2 and gcc-3.4.

The m68k.md file contains the following conditional statement:

#ifdef CASE_VECTOR_PC_RELATIVE
   operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
                gen_rtx_SIGN_EXTEND (SImode, operands[0]));
#endif

If the target configuration files undefine CASE_VECTOR_PC_RELATIVE, the
defaults.h header redefines CASE_VECTOR_PC_RELATIVE as follows:

/* Assume that case vectors are not pc-relative.  */
#ifndef CASE_VECTOR_PC_RELATIVE
#define CASE_VECTOR_PC_RELATIVE 0
#endif

The defaults.h header file is included after the target configuration files and
thus overrides the CASE_VECTOR_PC_RELATIVE.  The conditional statement in
config/m68k/m68k.md is therefore always satisfied even if the target
configuration undefines CASE_VECTOR_PC_RELATIVE.

I was able to resolve the issue with the following change to
config/m68k/m68k.md:

#if CASE_VECTOR_PC_RELATIVE != 0
   operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
                gen_rtx_SIGN_EXTEND (SImode, operands[0]));
#endif

t-rexky

Reply via email to