This is the mail archive of the
mailing list for the GCC project.
Re: syncing the GCC vax port, atomic issue
- From: coypu at sdf dot org
- To: gcc at gcc dot gnu dot org, port-vax at netbsd dot org
- Date: Fri, 20 Sep 2019 21:04:34 +0000
- Subject: Re: syncing the GCC vax port, atomic issue
- References: <20190330090306.GA29299@SDF.ORG> <firstname.lastname@example.org> <20190920111532.GB15685@SDF.ORG>
On Fri, Sep 20, 2019 at 11:15:32AM +0000, email@example.com wrote:
> Removed from the diff. Unfortunately this introduces an ICE during the
> build of GCC...
I took another look at the VAX atomic pattern issue.
It is a compiler crash to do with the added atomic builtins.
The original suggestion was to introduce a reversed pattern, with
label / pc swapped. It did not work, unfortunately.
The crash backtrace is (gcc-trunk line numbers):
during RTL pass: expand
/home/fly/gcc/libatomic/flag.c: In function 'atomic_flag_test_and_set':
/home/fly/gcc/libatomic/flag.c:36:1: internal compiler error: in patch_jump_insn, at cfgrtl.c:1291
36 | }
0x703909 redirect_edge_and_branch(edge_def*, basic_block_def*)
This seems to be where GCC has some logic specific to optimizing jumps.
Since this isn't a normal jump possible to eliminate by being clever,
but rather our only way of doing atomics, my gut feeling is that I
should avoid this jump optimizing code entirely.
Not telling GCC it's a jump worth optimizing seems to avoid the crash,
- emit_jump_insn (gen_jbbssi<mode> (operands, const0_rtx, label, operands));
+ emit_insn (gen_jbbssi<mode> (operands, const0_rtx, label, operands));
+ LABEL_NUSES (label)++;
GCC builds, but when building netbsd I get an undefined reference in
libstdc++.so: undefined reference to `.L72'
libstdc++.so: undefined reference to `.L75'
I wonder whether this is a right approach with a slightly off method.