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.
71:
72: ## DWARF ##
73:
74: flag_dwarf2_cfi_asm = 0;
75:
76: is kind of a big deal. We should probably get rid of it, but [binutils hates that.](https://github.com/NetBSD/src/commit/1df57dce3744cf4743358b098728a0658b80b8fb)
77:
78: ld: warning: dynamic relocation to `?' in readonly section `.eh_frame'
79: ld: warning: dynamic relocation to `?' in readonly section `.eh_frame'
80: ld: warning: creating a DT_TEXTREL in a shared object
81: ld: .eh_frame_hdr refers to overlapping FDEs
82: ld: final link failed: bad value
83:
84: ## review comments ##
85:
86: 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