Annotation of wikisrc/users/maya/vax-gcc.mdwn, revision 1.12

1.1       maya        1: # Various GCC/vax issues and invesigation #
                      2: 
1.8       maya        3: [WIP tree](gcc-mirror/)
                      4: 
1.12    ! maya        5: ## libgomp crash with -O2 [#58901](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58901) ##
1.1       maya        6: Repro:
                      7: 
1.2       maya        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: 
1.1       maya       21: Asserts at emit-rtl.c:2310 gcc_assert (memory_address_addr_space_p (mode, addr, as));
                     22: 
1.6       maya       23: NetBSD avoids it with a [local diff](https://github.com/NetBSD/src/commit/e437e96750193b86d0464965661f616e011056fa) to reload.c/dse.c.  
1.3       maya       24: It looks like a real bug in vax_legitimate_address_p not handling some addressing modes.  
1.2       maya       25: The code to handle offset(reg)[index] might be off: it doesn't like if neither xfoo0, xfoo1 are constant.
1.4       maya       26: 
1.12    ! maya       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: 
1.4       maya       45: ## unrecognizable insn with any optimization ##
                     46: 
                     47: Repro:
                     48: 
1.5       maya       49:     #!/bin/sh
1.4       maya       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: 
1.7       maya       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:     
1.11      maya       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.-->
1.9       maya       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: 
1.10      maya      105: [riscv seemed to share the issue](https://github.com/riscv/riscv-binutils-gdb/issues/76) and had fixed it.
                    106: 
1.9       maya      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