https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125323

            Bug ID: 125323
           Summary: vax: error: insn does not satisfy its constraints
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kalvisd at gmail dot com
  Target Milestone: ---

Created attachment 64462
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64462&action=edit
reduced test case

Hi,

While compiling libgcrypt from pkgsrc for NetBSD/vax, gcc/vax 14.3.0
crashed with the following error:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../mpi
-I/var/obj/pkgsrc/security/libgcrypt/work.vax-simh/.buildlink/include -O2
-fvisibility=hidden -fno-delete-null-pointer-checks -Wall -MT rijndael.lo -MD
-MP -MF .deps/rijndael.Tpo -c rijndael.c  -fPIC -DPIC -o .libs/rijndael.o
rijndael.c: In function 'do_setkey':
rijndael.c:1015:1: error: insn does not satisfy its constraints:
 1015 | }
      | ^
(insn 309 308 120 20 (parallel [
            (set (reg/v:SI 2 %r2 [orig:52 out ] [52])
                (zero_extract:SI (mem:SI (reg:SI 2 %r2) [1 enc_tables.T[_110]+0
S4 A32])
                    (const_int 8 [0x8])
                    (const_int 8 [0x8])))
            (clobber (reg:CC 16 %psl))
        ]) "rijndael.c":626:7 476 {*extzv_aligned_2}
     (expr_list:REG_UNUSED (reg:CC 16 %psl)
        (nil)))
during RTL pass: cprop_hardreg
rijndael.c:1015:1: internal compiler error: in extract_constrain_insn, at
recog.cc:2719
0xeea65a diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, void**, diagnostic_t)
        ???:0
0xeea8e3 internal_error(char const*, ...)
        ???:0
0xfbaaaa fancy_abort(char const*, int, char const*)
        ???:0
0xfba4da _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ???:0
0xfba51f _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ???:0
0x2a4737 extract_constrain_insn(rtx_insn*)
        ???:0
0xd4c74a copyprop_hardreg_forward_1(basic_block_def*, value_data*)
        ???:0
0xd4d54e (anonymous namespace)::cprop_hardreg_bb(basic_block_def*, value_data*,
simple_bitmap_def*)
        ???:0
0xd4d662 (anonymous namespace)::pass_cprop_hardreg::execute(function*)
        ???:0

The input file was reduced to the attachment [rijndael.i].

Compile with ${VAXGCC} -O2 -o rijndael.s -S rijndael.i 

GCC 15.2.0 on amd64, cross-compiling for vax, also crashed in the same
way when compiling the reduced input file.

The cause appears to be the earlyclobber constraint on the output
operand of the *extzv_aligned and *extzv_aligned_2<ccn><ccnz><ccz>
instruction patterns.  In this instance the source operands are a
memory location pointed to by %r2, and 2 constant integers; the
destination operand is a register, %r2, and the instruction that would
have been generated is a movzbl (%r2), %r2.  (I believe that this is
valid)

Removing the earlyclobber constraint resulted in successful
compilation of the reduced input file (and, further, allowed
compilation of libgcrypt to proceed to completion.  Once compiled, its
tests all passed, which is encouraging).

It's worth noting that the related *extv_aligned and
*extv_aligned_2<ccn><ccnz><ccz> instruction patterns do *not* have the
earlyclobber constraint on their output operands.

(This bug has also been observed in GCC12 and I believe it to also be
present in GCC16, based upon the instruction patterns in GCC16)

A proposed patch against GCC 15.2.0 is attached [gcc15-extzv.patch]

Regression testing results from GCC 15.2.0:

Before applying the patch:

                === g++ Summary ===

# of expected passes            216593
# of unexpected failures        10204
# of unexpected successes       8
# of expected failures          2120
# of unresolved testcases       1155
# of unsupported tests          5521
/gcc/15/gcc-15.2.0-amd64--netbsd-vax--netbsdelf/gcc/xg++  version 15.2.0 (GCC) 

                === gcc Summary ===

# of expected passes            155485
# of unexpected failures        1203
# of unexpected successes       1
# of expected failures          1130
# of unresolved testcases       70
# of unsupported tests          5688
/gcc/15/gcc-15.2.0-amd64--netbsd-vax--netbsdelf/gcc/xgcc  version 15.2.0 (GCC) 

Compilation of rijndael.i failed.

After applying the patch:

                === g++ Summary ===

# of expected passes            216593
# of unexpected failures        10204
# of unexpected successes       8
# of expected failures          2120
# of unresolved testcases       1155
# of unsupported tests          5521
/gcc/15/gcc-15.2.0-amd64--netbsd-vax--netbsdelf/gcc/xg++  version 15.2.0 (GCC) 

                === gcc Summary ===

# of expected passes            155485
# of unexpected failures        1203
# of unexpected successes       1
# of expected failures          1130
# of unresolved testcases       70
# of unsupported tests          5688
/gcc/15/gcc-15.2.0-amd64--netbsd-vax--netbsdelf/gcc/xgcc  version 15.2.0 (GCC) 

Compilation of rijndael.i succeeded.

Reply via email to