zhouwg / minigcc

customized toolchain for x86-ia32,learning and studying how Linaro create their various toolchain from scratch source code
GNU General Public License v2.0
0 stars 0 forks source link

minigcc's cc1 couldn't work fine with some c source file-- internal compiler error: in emit, at emit-rtl.c:5327 #9

Open zhouwg opened 4 years ago

zhouwg commented 4 years ago

GCC: wgzhou:$pwd /develop/minigcc wgzhou:$git checkout development wgzhou:$cd libgcc wgzhou:$pwd /develop/minigcc/libgcc wgzhou:$../gcc/xgcc -v Using built-in specs. COLLECT_GCC=../gcc/xgcc Target: i686-pc-linux-gnu Configured with: ../gcc-6.4.0/configure --prefix=/usr --libexecdir=/usr/lib --enable-static --enable-share --enable-threads=posix --disable-multilib --enable-languages=c,c++ --enable-languages=c,c++ --with-pkgversion='x86-ia32 toolchain for CDEOS' --with-bugurl=http://www.gnu.org --enable-clocale=gnu --with-system-zlib --enable-nls Thread model: posix gcc version 6.4.0 (GCC) wgzhou:$


Desc:

wgzhou:$../gcc/xgcc -c ../libgcc/config/i386/sfp-exceptions.c -o sfp-exceptions.o -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -mlong-double-80 -DUSE_ELF_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -mlong-double-80 -DUSE_ELF_SYMVER -I. -I. -I../gcc -I../libgcc -I./include -I../libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -fvisibility=hidden -DHIDE_EXPORTS -I../gcc -I./include -I../include -I../gcc/include-fixed/

/develop/minigcc/gcc/../libexec/gcc/cc1 -quiet -I . -I . -I ../gcc -I ../libgcc -I ./include -I ../libgcc/config/libbid -I ../gcc -I ./include -I ../include -I ../gcc/include-fixed/ -iprefix /develop/minigcc/gcc/../lib/gcc/i686-pc-linux-gnu/6.4.0/ -D IN_GCC -D USE_ELF_SYMVER -D IN_LIBGCC2 -D USE_ELF_SYMVER -D ENABLE_DECIMAL_BID_FORMAT -D HAVE_CC_TLS -D USE_TLS -D HIDE_EXPORTS ../libgcc/config/i386/sfp-exceptions.c -quiet -dumpbase sfp-exceptions.c -mlong-double-80 -mtune=generic -march=pentiumpro -auxbase-strip sfp-exceptions.o -g -Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wformat=0 -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -fbuilding-libgcc -fno-stack-protector -fvisibility=hidden -o /tmp/cc9KUELn.s

../libgcc/config/i386/sfp-exceptions.c: In function '__sfp_handle_exceptions': ../libgcc/config/i386/sfp-exceptions.c:107:1: internal compiler error: in emit, at emit-rtl.c:5327 }; ^ executable file is unexpected ELF class Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions.

zhouwg commented 4 years ago

../libgcc/config/i386/sfp-exceptions.c:107:1: internal compiler error: in emit, at emit-rtl.c:5327

wgzhou:$ diff sfp-exceptions.c.010t.eh /tmp/sfp-exceptions.c.010t.eh wgzhou:$ diff sfp-exceptions.c.001t.tu /tmp/sfp-exceptions.c.001t.tu wgzhou:$ diff sfp-exceptions.c.002t.class /tmp/sfp-exceptions.c.002t.class wgzhou:$ diff sfp-exceptions.c.003t.original /tmp/sfp-exceptions.c.003t.original wgzhou:$ diff sfp-exceptions.c.004t.gimple /tmp/sfp-exceptions.c.004t.gimple wgzhou:$ diff sfp-exceptions.c.006t.omplower /tmp/sfp-exceptions.c.006t.omplower wgzhou:$ diff sfp-exceptions.c.007t.lower /tmp/sfp-exceptions.c.007t.lower wgzhou:$ diff sfp-exceptions.c.010t.eh /tmp/sfp-exceptions.c.010t.eh wgzhou:$ diff sfp-exceptions.c.011t.cfg /tmp/sfp-exceptions.c.011t.cfg wgzhou:$ diff sfp-exceptions.c.012t.ompexp /tmp/sfp-exceptions.c.012t.ompexp wgzhou:$ diff sfp-exceptions.c.017t.fixup_cfg1 /tmp/sfp-exceptions.c.017t.fixup_cfg1 wgzhou:$ diff sfp-exceptions.c.018t.ssa.good /tmp/sfp-exceptions.c.018t.ssa

13a14,25
>   int D.1454;
>   short unsigned int D.1453;
>   short unsigned int D.1452;
>   int D.1449;
>   short unsigned int D.1448;
>   short unsigned int D.1447;
>   int D.1444;
>   int D.1441;
>   short unsigned int D.1440;
>   short unsigned int D.1439;
>   int D.1436;
>   int D.1433;
36d47
<   # DEBUG f => f_8
38d48
<   # DEBUG f => f_9
65d74
<   # DEBUG f => f_18
68d76
<   # DEBUG f => f_20
112d119
<   # DEBUG f => f_35
115d121
<   # DEBUG f => f_37
zhouwg commented 4 years ago

wgzhou:$ cat sfp-exceptions.c.018t.ssa.good

;; Function __sfp_handle_exceptions (__sfp_handle_exceptions, funcdef_no=0, decl_uid=1405, cgraph_uid=0, symbol_order=0)

__sfp_handle_exceptions (int _fex)
{
  float g;
  float f;
  struct fenv temp;
  struct fenv temp;
  float g;
  float f;
  struct fenv temp;
  float f;
  int _7;
  int _10;
  short unsigned int _13;
  short unsigned int _14;
  int _17;
  int _22;
  short unsigned int _24;
  short unsigned int _25;
  int _28;
  short unsigned int _30;
  short unsigned int _31;
  int _34;

  <bb 2>:
  _7 = _fex_6(D) & 1;
  if (_7 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  f_8 = 0.0;
  #DEBUG f => f_8
  __asm__ __volatile__("fdiv    {%y0, %0|%0, %y0}" : "=t" f_9 : "0" f_8);
  #DEBUG f => f_9

  <bb 4>:
  _10 = _fex_6(D) & 2;
  if (_10 != 0)
    goto <bb 5>;
  else
    goto <bb 6>;

  <bb 5>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _13 = temp.__status_word;
  _14 = _13 | 2;
  temp.__status_word = _14;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 6>:
  _17 = _fex_6(D) & 4;
  if (_17 != 0)
    goto <bb 7>;
  else
    goto <bb 8>;

  <bb 7>:
  f_18 = 1.0e+0;
  #DEBUG f => f_18
  g = 0.0;
  __asm__ __volatile__("fdivs   %1" : "=t" f_20 : "m" g, "0" f_18);
 #DEBUG f => f_20
  g ={v} {CLOBBER};

  <bb 8>:
  _22 = _fex_6(D) & 8;
  if (_22 != 0)
    goto <bb 9>;
  else
    goto <bb 10>;

  <bb 9>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _24 = temp.__status_word;
  _25 = _24 | 8;
  temp.__status_word = _25;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 10>:
  _28 = _fex_6(D) & 16;
  if (_28 != 0)
    goto <bb 11>;
  else
    goto <bb 12>;

  <bb 11>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _30 = temp.__status_word;
  _31 = _30 | 16;
  temp.__status_word = _31;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 12>:
  _34 = _fex_6(D) & 32;
  if (_34 != 0)
    goto <bb 13>;
  else
    goto <bb 14>;

  <bb 13>:
  f_35 = 1.0e+0;
#DEBUG f => f_35
  g = 3.0e+0;
  __asm__ __volatile__("fdivs   %1" : "=t" f_37 : "m" g, "0" f_35);
 #DEBUG f => f_37
  g ={v} {CLOBBER};

  <bb 14>:
  return;

}
zhouwg commented 4 years ago

wgzhou:$ cat sfp-exceptions.c.018t.ssa

;; Function __sfp_handle_exceptions (__sfp_handle_exceptions, funcdef_no=0, decl_uid=1405, cgraph_uid=0, symbol_order=0)

__sfp_handle_exceptions (int _fex)
{
  float g;
  float f;
  struct fenv temp;
  struct fenv temp;
  float g;
  float f;
  struct fenv temp;
  float f;
  int D.1454;
  short unsigned int D.1453;
  short unsigned int D.1452;
  int D.1449;
  short unsigned int D.1448;
  short unsigned int D.1447;
  int D.1444;
  int D.1441;
  short unsigned int D.1440;
  short unsigned int D.1439;
  int D.1436;
  int D.1433;
  int _7;
  int _10;
  short unsigned int _13;
  short unsigned int _14;
  int _17;
  int _22;
  short unsigned int _24;
  short unsigned int _25;
  int _28;
  short unsigned int _30;
  short unsigned int _31;
  int _34;

  <bb 2>:
  _7 = _fex_6(D) & 1;
  if (_7 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  f_8 = 0.0;
  __asm__ __volatile__("fdiv    {%y0, %0|%0, %y0}" : "=t" f_9 : "0" f_8);

  <bb 4>:
  _10 = _fex_6(D) & 2;
  if (_10 != 0)
    goto <bb 5>;
  else
    goto <bb 6>;

  <bb 5>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _13 = temp.__status_word;
  _14 = _13 | 2;
  temp.__status_word = _14;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 6>:
  _17 = _fex_6(D) & 4;
  if (_17 != 0)
    goto <bb 7>;
  else
    goto <bb 8>;

  <bb 7>:
  f_18 = 1.0e+0;
  g = 0.0;
  __asm__ __volatile__("fdivs   %1" : "=t" f_20 : "m" g, "0" f_18);
  g ={v} {CLOBBER};

  <bb 8>:
  _22 = _fex_6(D) & 8;
  if (_22 != 0)
    goto <bb 9>;
  else
    goto <bb 10>;

  <bb 9>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _24 = temp.__status_word;
  _25 = _24 | 8;
  temp.__status_word = _25;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 10>:
  _28 = _fex_6(D) & 16;
  if (_28 != 0)
    goto <bb 11>;
  else
    goto <bb 12>;

  <bb 11>:
  __asm__ __volatile__("fnstenv %0" : "=m" temp);
  _30 = temp.__status_word;
  _31 = _30 | 16;
  temp.__status_word = _31;
  __asm__ __volatile__("fldenv  %0" :  : "m" temp);
  __asm__ __volatile__("fwait");
  temp ={v} {CLOBBER};

  <bb 12>:
  _34 = _fex_6(D) & 32;
  if (_34 != 0)
    goto <bb 13>;
  else
    goto <bb 14>;

  <bb 13>:
  f_35 = 1.0e+0;
  g = 3.0e+0;
  __asm__ __volatile__("fdivs   %1" : "=t" f_37 : "m" g, "0" f_35);
  g ={v} {CLOBBER};

  <bb 14>:
  return;

}