From 55429190dd99a471a22b88a9576920b6cf17d803 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Thu, 18 Jun 2015 10:18:48 +0000 Subject: [PATCH] re PR target/66569 ([CHKP] internal compiler error: in assign_by_spills) gcc/ PR target/66569 * function.c (assign_bounds): Add arguments assign_regs, assign_special, assign_bt. (assign_parms): For vararg functions handle bounds in BT and special slots after incoming vararg bounds. gcc/testsuite/ PR target/66569 * gcc.target/i386/mpx/chkp-vararg.c: New test. From-SVN: r224602 --- gcc/ChangeLog | 8 +++++ gcc/function.c | 33 +++++++++++---------- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/i386/mpx/pr66569.c | 14 +++++++++ 4 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr66569.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23301d4beee..fae12ccdd1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-06-18 Ilya Enkovich + + PR target/66569 + * function.c (assign_bounds): Add arguments assign_regs, + assign_special, assign_bt. + (assign_parms): For vararg functions handle bounds in BT + and special slots after incoming vararg bounds. + 2015-06-18 Ilya Enkovich PR middle-end/66568 diff --git a/gcc/function.c b/gcc/function.c index ac0458a6cc8..ea0eba8fe85 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3489,9 +3489,11 @@ assign_parm_load_bounds (struct assign_parm_data_one *data, static void assign_bounds (vec &bndargs, - struct assign_parm_data_all &all) + struct assign_parm_data_all &all, + bool assign_regs, bool assign_special, + bool assign_bt) { - unsigned i, pass, handled = 0; + unsigned i, pass; bounds_parm_data *pbdata; if (!bndargs.exists ()) @@ -3505,17 +3507,20 @@ assign_bounds (vec &bndargs, { /* Pass 0 => regs only. */ if (pass == 0 - && (!pbdata->parm_data.entry_parm - || GET_CODE (pbdata->parm_data.entry_parm) != REG)) + && (!assign_regs + ||(!pbdata->parm_data.entry_parm + || GET_CODE (pbdata->parm_data.entry_parm) != REG))) continue; /* Pass 1 => slots only. */ else if (pass == 1 - && (!pbdata->parm_data.entry_parm - || GET_CODE (pbdata->parm_data.entry_parm) == REG)) + && (!assign_special + || (!pbdata->parm_data.entry_parm + || GET_CODE (pbdata->parm_data.entry_parm) == REG))) continue; /* Pass 2 => BT only. */ else if (pass == 2 - && pbdata->parm_data.entry_parm) + && (!assign_bt + || pbdata->parm_data.entry_parm)) continue; if (!pbdata->parm_data.entry_parm @@ -3536,14 +3541,7 @@ assign_bounds (vec &bndargs, else assign_parm_setup_stack (&all, pbdata->bounds_parm, &pbdata->parm_data); - - /* Count handled bounds to make sure we miss nothing. */ - handled++; } - - gcc_assert (handled == bndargs.length ()); - - bndargs.release (); } /* Assign RTL expressions to the function's parameters. This may involve @@ -3668,12 +3666,14 @@ assign_parms (tree fndecl) /* We expect this is the last parm. Otherwise it is wrong to assign bounds right now. */ gcc_assert (i == (fnargs.length () - 1)); - assign_bounds (bndargs, all); + assign_bounds (bndargs, all, true, false, false); targetm.calls.setup_incoming_vararg_bounds (all.args_so_far, data.promoted_mode, data.passed_type, &pretend_bytes, false); + assign_bounds (bndargs, all, false, true, true); + bndargs.release (); } } @@ -3685,7 +3685,8 @@ assign_parms (tree fndecl) bound_no++; } - assign_bounds (bndargs, all); + assign_bounds (bndargs, all, true, true, true); + bndargs.release (); if (targetm.calls.split_complex_arg) assign_parms_unsplit_complex (&all, fnargs); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b1d0710c1a..7692ae53382 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-18 Ilya Enkovich + + PR target/66569 + * gcc.target/i386/mpx/chkp-vararg.c: New test. + 2015-06-18 Ilya Enkovich PR middle-end/66568 diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66569.c b/gcc/testsuite/gcc.target/i386/mpx/pr66569.c new file mode 100644 index 00000000000..ba2023c6846 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66569.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +struct s1 { + int *p; + int i; +}; + +struct s2 { + struct s1 s; + int i; +}; + +int test (struct s2 s, ...) { } -- 2.30.2