File:  [NetBSD Developer Wiki] / wikisrc / users / maya / vax-gcc.mdwn
Revision 1.12: download - view: text, annotated - select for diffs
Sun Sep 15 12:56:38 2019 UTC (2 years, 1 month ago) by maya
Branches: MAIN
CVS tags: HEAD
Add some upstream bug reports.

    1: # Various GCC/vax issues and invesigation #
    2: 
    3: [WIP tree](gcc-mirror/)
    4: 
    5: ## libgomp crash with -O2 [#58901](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58901) ##
    6: Repro:
    7: 
    8:     #!/bin/sh
    9:     
   10:     cat << EOF > oacc.i
   11:     int a, b;
   12:     int e() {
   13:       short *c = 0;
   14:       char d = c[a + 1];
   15:       b = d;
   16:       a += 2;
   17:     }
   18:     EOF
   19:     vax--netbsdelf-gcc -O2 -c oacc.i
   20: 
   21: Asserts at emit-rtl.c:2310 gcc_assert (memory_address_addr_space_p (mode, addr, as));
   22: 
   23: NetBSD avoids it with a [local diff](https://github.com/NetBSD/src/commit/e437e96750193b86d0464965661f616e011056fa) to reload.c/dse.c.  
   24: It looks like a real bug in vax_legitimate_address_p not handling some addressing modes.  
   25: The code to handle offset(reg)[index] might be off: it doesn't like if neither xfoo0, xfoo1 are constant.
   26: 
   27: 
   28: ## change_address_1, at emit-rtl.c:2286 [#85152](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85152) ##
   29: 
   30: Repro:
   31: 
   32:     #!/bin/sh
   33: 
   34:     cat << EOF > oacc.i
   35:     void fn2();
   36:     unsigned a;
   37:     int fn1() {
   38:       int b = a >> 16;
   39:       if (b)
   40:         fn2();
   41:     }
   42:     EOF
   43:     vax--netbsdelf-gcc -O2 -c oacc.i
   44: 
   45: ## unrecognizable insn with any optimization ##
   46: 
   47: Repro:
   48: 
   49:     #!/bin/sh
   50: 
   51:     cat << EOF > decl.ii
   52:     struct a {
   53:       long long *b() const;
   54:     };
   55:     template <typename> class d : a {
   56:     public:
   57:       template <typename e> d(e);
   58:       long long f() const;
   59:     };
   60:     template <typename c> long long d<c>::f() const {
   61:       int g;
   62:       return b()[g];
   63:     }
   64:     int h;
   65:     bool i() {
   66:       d<int> j(h);
   67:       return j.f();
   68:     }
   69:     EOF
   70:     vax--netbsdelf-g++ -O2 -c decl.ii
   71: 
   72: This errors out with:
   73: 
   74:     $ env PATH=$PWD:$PATH ./xgcc -fno-use-linker-plugin -c -O2 ~/oacc/decl.ii -fno-tree-vectorize
   75:     /home/fly/oacc/decl.ii: In function 'bool i()':
   76:     /home/fly/oacc/decl.ii:17:1: error: unrecognizable insn:
   77:        17 | }
   78:           | ^
   79:     (insn 13 12 14 2 (set (reg:SI 33)
   80:             (subreg:SI (mem:DI (plus:SI (mult:SI (reg/v:SI 24 [ g ])
   81:                             (const_int 8 [0x8]))
   82:                         (reg/f:SI 23 [ _6 ])) [1 *_10+0 S8 A32]) 4)) "/home/fly/oacc/decl.ii":16:14 -1
   83:          (nil))
   84:     during RTL pass: vregs
   85:     /home/fly/oacc/decl.ii:17:1: internal compiler error: in extract_insn, at recog.c:2310
   86:     
   87: 
   88: This is in VAX-specific code. We need to figure out what instruction pattern this is, that we're missing.
   89: 
   90: <!--Providing a trivial scheduling will avoid subregs of mem.  
   91: However, this doesn't work for us. Our crash and mem subregs happen at a too early pass, most likely.-->
   92: 
   93: ## DWARF ##
   94: 
   95:     flag_dwarf2_cfi_asm = 0;
   96: 
   97: is kind of a big deal. We should probably get rid of it, but [binutils hates that.](https://github.com/NetBSD/src/commit/1df57dce3744cf4743358b098728a0658b80b8fb)
   98: 
   99:     ld: warning: dynamic relocation to `?' in readonly section `.eh_frame'
  100:     ld: warning: dynamic relocation to `?' in readonly section `.eh_frame'
  101:     ld: warning: creating a DT_TEXTREL in a shared object
  102:     ld: .eh_frame_hdr refers to overlapping FDEs
  103:     ld: final link failed: bad value
  104: 
  105: [riscv seemed to share the issue](https://github.com/riscv/riscv-binutils-gdb/issues/76) and had fixed it.
  106: 
  107: ## review comments ##
  108: 
  109: Jeff Law [provided some feedback](https://gcc.gnu.org/ml/gcc/2019-04/msg00281.html). More of it should be addressed.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb