5.2.3.1. gcc-4.2.2/gcc/regrename.c:1646:12: error: ‘IFCVT_ALLOW_MODIFY_TEST_IN_INSN’ undeclared (first use in this function)

错误现象:

cygwin下ct-ng build去编译crosstool-ng出现:


CLi@PC-CLI-1 ~/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng build
[INFO ]  Performing some trivial sanity checks
......
[INFO ]  =================================================================
[INFO ]  Installing pass-1 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[ERROR]    /home/CLi/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/gcc-4.2.2/gcc/regrename.c:1646:12: error: 'IFCVT_ALLOW_MODIFY_TEST_IN_INSN' undeclared (first use in this function)
[ERROR]    make[2]: *** [regrename.o] Error 1
[ERROR]    make[1]: *** [all-gcc] Error 2
...

            

原因:

暂未清楚深层次的原因。

解决办法:

去修改对应的文件:

crosstool-ng-1.18.0_build\.build\src\gcc-4.2.2\gcc\regrename.c

去注释掉对应的代码,变成:



      /* Added for targets (AVR32) which supports test operands to be modified
         in cond_exec instruction. For these targets we cannot make a change to
         the test operands if one of the test operands is an output operand This beacuse
         changing the test operands might cause the need for inserting a new test
         insns in the middle of a sequence of cond_exec insns and if the test operands
         are modified these tests will fail.
      */
      
      // if ( IFCVT_ALLOW_MODIFY_TEST_IN_INSN
           // && predicated )
        // { 
          // int insn_skipped = 0;
          // rtx test = COND_EXEC_TEST (PATTERN (insn));

          // /* Check if the previous insn was a skipped predicated insn with the same
             // test as this predicated insns. If so we cannot do any modification to
             // this insn either since we cannot emit the test insn because the operands
             // are clobbered. */
          // if ( prev_pred_insn_skipped 
               // && (rtx_equal_p (test, prev_pred_test) 
                   // || rtx_equal_p (test, reversed_condition (prev_pred_test))) )
            // { 
              // insn_skipped = 1;
            // }
          // else
            // {
              // /* Check if the output operand is used in the test expression. */
              // for (i = 0; i < n_ops; ++i)
                // if ( recog_data.operand_type[i] == OP_INOUT 
                     // && reg_mentioned_p (recog_data.operand[i], test) )
                  // {
                    // insn_skipped = 1;
                    // break;
                  // }
              
            // }
          
          // prev_pred_test = test;
          // prev_pred_insn_skipped = insn_skipped;
          // if ( insn_skipped )
            // {
              // if (insn == BB_END (bb))
                // break;
              // else
                // continue;
            // }
        // } 
      // else 
        // {
          // prev_pred_insn_skipped = 0;
        // }

            

即可。

详见:【未解决】crosstool-ng编译出错:gcc-4.2.2/gcc/regrename.c:1646:12: error: ‘IFCVT_ALLOW_MODIFY_TEST_IN_INSN’ undeclared (first use in this function)