gtype-desc.c:8893:18: error: subscripted value ...

做LFS时,7.1版本,编译gcc时遇到
lfs:/mnt/lfs/sources/gcc-build/gcc$ gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.6.2/gcc -I../../gcc-4.6.2/gcc/. -I../../gcc-4.6.2/gcc/../include -I../../gcc-4.6.2/gcc/../libcpp/include -I/mnt/lfs/sources/gcc-build/./gmp -I/mnt/lfs/sources/gcc-4.6.2/gmp -I/mnt/lfs/sources/gcc-build/../gcc-4.6.2/mpfr/src -I/mnt/lfs/sources/gcc-4.6.2/mpc/src  -I../../gcc-4.6.2/gcc/../libdecnumber -I../../gcc-4.6.2/gcc/../libdecnumber/dpd -I../libdecnumber    gtype-desc.c -o gtype-desc.o
gtype-desc.c:8893:18: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9012:36: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9096:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9117:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9124:31: error: subscripted value is neither array nor pointer nor vector
gtype-desc.c:9131:31: error: subscripted value is neither array nor pointer nor vector

解决办法:

修改gcc source下的gcc/gengtype.c(大概在3603行)把struct pair newv 移动到if 外解决:

修改为:

static void
write_field_root (outf_p f, pair_p v, type_p type, const char *name,
                  int has_length, struct fileloc *line, const char *if_marked,
                  bool emit_pch, type_p field_type, const char *field_name)
{
  /* If the field reference is relative to V, rather than to some
     subcomponent of V, we can mark any subarrays with a single stride.
     We're effectively treating the field as a global variable in its
     own right.  */
      struct pair newv;
  if (v && type == v->type)
    {
      newv = *v;
      newv.type = field_type;
      newv.name = ACONCAT ((v->name, ".", field_name, NULL));
      v = &newv;
    }
  /* Otherwise, any arrays nested in the structure are too complex to
     handle.  */
  else if (field_type->kind == TYPE_ARRAY)
    v = NULL;
  write_root (f, v, field_type, ACONCAT ((name, ".", field_name, NULL)),
              has_length, line, if_marked, emit_pch);
}



Type the name of a command and press enter to execute it, or help for assistance.

转载于:https://my.oschina.net/ailou/blog/102981

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值