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



             Bug #: 56023

           Summary: [4.6 Regression]: [alpha] -fcompare-debug failure due

                    to sched1 pass

    Classification: Unclassified

           Product: gcc

           Version: 4.6.4

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: rtl-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ubiz...@gmail.com

              Host: x86_64-linux-gnu

            Target: alpha-linux-gnu





Following compare-debug failure breaks bootstrap on alpha-linux-gnu on 4.6:



--cut here--

void

foo (char *c)

{

  unsigned int x = 0;

  unsigned int i;



  for (i = 0; c[i]; i++)

    {

      if (i >= 5 && x != 1)

    break;

      else if (c[i] == ' ')

    x = i;

      else if (c[i] == '/' && c[i + 1] != ' ' && i)

    x = i + 1;

    }

}

--cut here--



The compare-debug failure can be reproduced on a cross to alpha-linux-gnu:



~/gcc-build-alpha/gcc/xgcc -B ~/gcc-build-alpha/gcc -O2 -fcompare-debug -S t.c

xgcc: error: t.c: -fcompare-debug failure



~/gcc-build-alpha/gcc/xgcc -v

Using built-in specs.

COLLECT_GCC=/home/uros/gcc-build-alpha/gcc/xgcc

Target: alpha-linux-gnu

Configured with: ../gcc-svn/branches/gcc-4_6-branch/configure

--target=alpha-linux-gnu

Thread model: posix

gcc version 4.6.4 20130117 (prerelease) [gcc-4_6-branch revision 195276] (GCC)



The resulting assembly differs in:



--with g--

$L8:

$LM8:

    cmpeq $5,1,$5     # 30    *setcc_internal    [length = 4]

    cmpult $8,$2,$2     # 35    *setcc_internal    [length = 4]

    cmpeq $5,0,$5     # 31    *setcc_internal    [length = 4]

(*)    addl $3,1,$3     # 43    *addsi_se/1    [length = 4]

    and $5,$2,$2     # 39    anddi3/1    [length = 4]

    cpys $f31,$f31,$f31     # 171    fnop    [length = 4]

(**)    addl $4,1,$4     # 41    *addsi_se/1    [length = 4]

    bne $2,$L1     # 44    *bcc_normal    [length = 4]

$L9:

--/with g--



--without g--

$L8:

    cmpeq $5,1,$5     # 26    *setcc_internal    [length = 4]

    cmpult $8,$2,$2     # 31    *setcc_internal    [length = 4]

    cmpeq $5,0,$5     # 27    *setcc_internal    [length = 4]

(**)    addl $4,1,$4     # 37    *addsi_se/1    [length = 4]

    and $5,$2,$2     # 35    anddi3/1    [length = 4]

    cpys $f31,$f31,$f31     # 143    fnop    [length = 4]

(*)    addl $3,1,$3     # 39    *addsi_se/1    [length = 4]

    bne $2,$L1     # 40    *bcc_normal    [length = 4]

$L9:

--/without g--



Insns (*) and (**) switched places when compiled w/ or w/o "-g".



The problem is in sched1 pass, where the first difference occurs, and adding

-fno-schedule-insns to compile flags avoids the failure.

Reply via email to