Bug 90723 - pr88598-2.c segfaults with -msve-vector-bits=256
Summary: pr88598-2.c segfaults with -msve-vector-bits=256
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: prathamesh3492
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-03 12:03 UTC by prathamesh3492
Modified: 2019-10-15 16:15 UTC (History)
1 user (show)

See Also:
Host:
Target: aarch64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prathamesh3492 2019-06-03 12:03:42 UTC
cc1 segfaults with the following test-case, with -O2 -march=armv8.2-a+sve -msve-vector-bits=256:

typedef double v4df __attribute__ ((vector_size (32)));

void foo(v4df);

int
main ()
{
  volatile v4df x1;
  x1 = (v4df) { 0, 1, 1, 2 };
  foo (x1);
  return 0;
}

gdb backtrace (clipped to last 14):

Program received signal SIGSEGV, Segmentation fault.
0x0000000000bfdad1 in expand_binop_directly (icode=CODE_FOR_adddi3, mode=mode@entry=E_DImode, binoptab=binoptab@entry=add_optab, 
    op0=op0@entry=0x7ffff7a233a8, op1=op1@entry=0x7ffff7a2b290, target=target@entry=0x7ffff5095468, unsignedp=1, methods=OPTAB_LIB_WIDEN, 
    last=0x7ffff5094bc0) at ../../gcc/gcc/optabs.c:1038
1038	{
(gdb) bt
#0  0x0000000000bfdad1 in expand_binop_directly (icode=CODE_FOR_adddi3, mode=mode@entry=E_DImode, binoptab=binoptab@entry=add_optab, 
    op0=op0@entry=0x7ffff7a233a8, op1=op1@entry=0x7ffff7a2b290, target=target@entry=0x7ffff5095468, unsignedp=1, methods=OPTAB_LIB_WIDEN, 
    last=0x7ffff5094bc0) at ../../gcc/gcc/optabs.c:1038
#1  0x0000000000bfc0dd in expand_binop (mode=E_DImode, binoptab=<optimized out>, op0=0x7ffff7a233a8, op1=0x7ffff7a2b290, target=0x7ffff5095468, 
    unsignedp=1, methods=OPTAB_LIB_WIDEN) at ../../gcc/gcc/optabs.c:1209
#2  0x00000000009cc7e4 in force_operand (value=0x7ffff7859f90, target=0x7ffff5095468) at ../../gcc/gcc/expr.c:7527
#3  0x00000000009a80a3 in copy_to_mode_reg (mode=E_DImode, x=x@entry=0x7ffff7859f90) at ../../gcc/gcc/explow.c:627
#4  0x0000000000bf2dce in maybe_legitimize_operand_same_code (icode=icode@entry=CODE_FOR_aarch64_pred_movvnx2df, opno=opno@entry=2, op=<optimized out>)
    at ../../gcc/gcc/optabs.c:7146
#5  0x0000000000bf56ee in maybe_legitimize_operand (op=0x7ffffbfff400, opno=2, icode=CODE_FOR_aarch64_pred_movvnx2df) at ../../gcc/gcc/optabs.c:7196
#6  maybe_legitimize_operands (icode=CODE_FOR_aarch64_pred_movvnx2df, opno=0, nops=<optimized out>, ops=0x7ffffbfff3c0) at ../../gcc/gcc/optabs.c:7323
#7  0x0000000000bf5c0a in maybe_gen_insn (icode=CODE_FOR_aarch64_pred_movvnx2df, nops=<optimized out>, ops=0x7ffffbfff3c0)
    at ../../gcc/gcc/optabs.c:7342
#8  0x0000000000bf8c39 in maybe_expand_insn (ops=ops@entry=0x7ffffbfff3b0, nops=nops@entry=3, icode=<optimized out>) at ../../gcc/gcc/optabs.c:7416
#9  expand_insn (icode=<optimized out>, nops=nops@entry=3, ops=ops@entry=0x7ffffbfff3c0) at ../../gcc/gcc/optabs.c:7416
#10 0x00000000010378a4 in aarch64_emit_sve_pred_move (dest=<optimized out>, pred=<optimized out>, src=<optimized out>) at ./insn-opinit.h:735
#11 0x00000000012cb710 in gen_movvnx2df (operand0=0x7ffff5095408, operand1=0x7ffff7859f78) at ../../gcc/gcc/config/aarch64/aarch64-sve.md:77
#12 0x00000000009c7505 in insn_gen_fn::operator() (this=<optimized out>, a1=0x7ffff7859f78, a0=0x7ffff5095408) at ../../gcc/gcc/recog.h:301
#13 emit_move_insn_1 (x=0x7ffff5095408, y=0x7ffff7859f78) at ../../gcc/gcc/expr.c:3701
#14 0x00000000009c7950 in emit_move_insn (x=x@entry=0x7ffff5095408, y=y@entry=0x7ffff7859f78) at ../../gcc/gcc/expr.c:3797

Thanks,
Prathamesh
Comment 1 prathamesh3492 2019-07-13 08:29:04 UTC
Author: prathamesh3492
Date: Sat Jul 13 08:28:33 2019
New Revision: 273466

URL: https://gcc.gnu.org/viewcvs?rev=273466&root=gcc&view=rev
Log:
2019-07-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	PR target/90723
	* recog.h (temporary_volatile_ok): New class.
	* config/aarch64/aarch64.c (aarch64_emit_sve_pred_move): Set
	volatile_ok temporarily to true using temporary_volatile_ok.
	* expr.c (emit_block_move_via_cpymem): Likewise.
	* optabs.c (maybe_legitimize_operand): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.c
    trunk/gcc/expr.c
    trunk/gcc/optabs.c
    trunk/gcc/recog.h
Comment 2 Eric Gallager 2019-10-13 04:18:22 UTC
(In reply to prathamesh3492 from comment #1)
> Author: prathamesh3492
> Date: Sat Jul 13 08:28:33 2019
> New Revision: 273466
> 
> URL: https://gcc.gnu.org/viewcvs?rev=273466&root=gcc&view=rev
> Log:
> 2019-07-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
> 
> 	PR target/90723
> 	* recog.h (temporary_volatile_ok): New class.
> 	* config/aarch64/aarch64.c (aarch64_emit_sve_pred_move): Set
> 	volatile_ok temporarily to true using temporary_volatile_ok.
> 	* expr.c (emit_block_move_via_cpymem): Likewise.
> 	* optabs.c (maybe_legitimize_operand): Likewise.
> 
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/config/aarch64/aarch64.c
>     trunk/gcc/expr.c
>     trunk/gcc/optabs.c
>     trunk/gcc/recog.h

Did this fix it?
Comment 3 prathamesh3492 2019-10-15 07:26:59 UTC
(In reply to Eric Gallager from comment #2)
> (In reply to prathamesh3492 from comment #1)
> > Author: prathamesh3492
> > Date: Sat Jul 13 08:28:33 2019
> > New Revision: 273466
> > 
> > URL: https://gcc.gnu.org/viewcvs?rev=273466&root=gcc&view=rev
> > Log:
> > 2019-07-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
> > 
> > 	PR target/90723
> > 	* recog.h (temporary_volatile_ok): New class.
> > 	* config/aarch64/aarch64.c (aarch64_emit_sve_pred_move): Set
> > 	volatile_ok temporarily to true using temporary_volatile_ok.
> > 	* expr.c (emit_block_move_via_cpymem): Likewise.
> > 	* optabs.c (maybe_legitimize_operand): Likewise.
> > 
> > Modified:
> >     trunk/gcc/ChangeLog
> >     trunk/gcc/config/aarch64/aarch64.c
> >     trunk/gcc/expr.c
> >     trunk/gcc/optabs.c
> >     trunk/gcc/recog.h
> 
> Did this fix it?
Yes.

Thanks,
Prathamesh
Comment 4 Eric Gallager 2019-10-15 16:15:17 UTC
(In reply to prathamesh3492 from comment #3)
> (In reply to Eric Gallager from comment #2)
> > (In reply to prathamesh3492 from comment #1)
> > > Author: prathamesh3492
> > > Date: Sat Jul 13 08:28:33 2019
> > > New Revision: 273466
> > > 
> > > URL: https://gcc.gnu.org/viewcvs?rev=273466&root=gcc&view=rev
> > > Log:
> > > 2019-07-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
> > > 
> > > 	PR target/90723
> > > 	* recog.h (temporary_volatile_ok): New class.
> > > 	* config/aarch64/aarch64.c (aarch64_emit_sve_pred_move): Set
> > > 	volatile_ok temporarily to true using temporary_volatile_ok.
> > > 	* expr.c (emit_block_move_via_cpymem): Likewise.
> > > 	* optabs.c (maybe_legitimize_operand): Likewise.
> > > 
> > > Modified:
> > >     trunk/gcc/ChangeLog
> > >     trunk/gcc/config/aarch64/aarch64.c
> > >     trunk/gcc/expr.c
> > >     trunk/gcc/optabs.c
> > >     trunk/gcc/recog.h
> > 
> > Did this fix it?
> Yes.
> 
> Thanks,
> Prathamesh

Ok, thanks, closing then