Hi, On 3/3/26 04:12, John Paul Adrian Glaubitz wrote:
On Mon, 2026-03-02 at 16:57 +0000, John Klos wrote:https://www.klos.com/~john/toke.cThanks! Btw, what version of GCC is this? 14?It's NetBSD 11.0_RC1, so the gcc version is: cc (nb1 20260119) 12.5.0Hmm, that's still quite old when GCC 15.2.0 is the current version. I'll try to reproduce it with GCC 15.2.0 and file an upstream bug report if it's reproducible there.
Some observations which may be helpful (bearing in mind that I'm not an expert!):
This problem also appears when cross-compiling.I was able to generate a reduced test case (https://www.netbsd.org/~kalvisd/11.0rc1-gcc-12.5.0-vax-perl-insn-constraints-toke-reduced.i)
I wasn't able to reproduce the problem in GCC 14.3.0 (from NetBSD-current) or GCC 15.2.0 from upstream, either with the reduced test case or the original 'toke.i'.
After a bit of debugging, it seems that GCC 12 found that the output operand for the '*extzv_aligned_2' instruction pattern conflicts with one of the input operands. The input operands in this case are 2 constants and an operand that is either a register or a memory address (not using pre/post increment or decrement addressing modes). The output operand has the 'earlyclobber' constraint, indicating that it is modified before the instruction has finished using the input operands, so the output may not be in a register that's used as an input operand or as part of any memory address.
The constraints on '*extzv_aligned_2' are unchanged in GCC 15.2.0.The output operands of the related '*extv_aligned' patterns do not have the 'earlyclobber' constraint.
'*extzv_aligned_2' emits a move instruction and none of the move instruction patterns' output operands have the 'earlyclobber' constraint.
I'm not sure that I understand why the 'earlyclobber' constraint is applied to the output operand of '*extzv_aligned_2'. If I remove the 'earlyclobber' constraint, GCC 12.5.0 compiles both the reduced test case and the original 'toke.i' without incident. (Also the NetBSD distribution, but it did that before.)
kalvis