File:  [NetBSD Developer Wiki] / wikisrc / users / maya / vax-gcc.mdwn
Revision 1.8: download - view: text, annotated - select for diffs
Fri Aug 30 02:09:23 2019 UTC (5 months, 3 weeks ago) by maya
Branches: MAIN
CVS tags: HEAD
Link to my tree, provide more info about how the suggested workaround
doesn't work.

    1: # Various GCC/vax issues and invesigation #
    2: 
    3: [WIP tree](gcc-mirror/)
    4: 
    5: ## libgomp crash with -O2 ##
    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: ## unrecognizable insn with any optimization ##
   28: 
   29: Repro:
   30: 
   31:     #!/bin/sh
   32: 
   33:     cat << EOF > decl.ii
   34:     struct a {
   35:       long long *b() const;
   36:     };
   37:     template <typename> class d : a {
   38:     public:
   39:       template <typename e> d(e);
   40:       long long f() const;
   41:     };
   42:     template <typename c> long long d<c>::f() const {
   43:       int g;
   44:       return b()[g];
   45:     }
   46:     int h;
   47:     bool i() {
   48:       d<int> j(h);
   49:       return j.f();
   50:     }
   51:     EOF
   52:     vax--netbsdelf-g++ -O2 -c decl.ii
   53: 
   54: This errors out with:
   55: 
   56:     $ env PATH=$PWD:$PATH ./xgcc -fno-use-linker-plugin -c -O2 ~/oacc/decl.ii -fno-tree-vectorize
   57:     /home/fly/oacc/decl.ii: In function 'bool i()':
   58:     /home/fly/oacc/decl.ii:17:1: error: unrecognizable insn:
   59:        17 | }
   60:           | ^
   61:     (insn 13 12 14 2 (set (reg:SI 33)
   62:             (subreg:SI (mem:DI (plus:SI (mult:SI (reg/v:SI 24 [ g ])
   63:                             (const_int 8 [0x8]))
   64:                         (reg/f:SI 23 [ _6 ])) [1 *_10+0 S8 A32]) 4)) "/home/fly/oacc/decl.ii":16:14 -1
   65:          (nil))
   66:     during RTL pass: vregs
   67:     /home/fly/oacc/decl.ii:17:1: internal compiler error: in extract_insn, at recog.c:2310
   68:     
   69: Providing a trivial scheduling will avoid subregs of mem.  
   70: However, this doesn't work for us. Our crash and mem subregs happen at a too early pass, most likely.

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