From b8bb5772c6cbb043e60229ecc68806d91efe079f Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 1 Aug 2017 12:57:55 +0200 Subject: [PATCH] re PR target/81639 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2669 with a naked function) PR target/81639 * config/i386/i386.c (ix86_funciton_naked): New prototype. (ix86_function_ok_for_sibcall): Return false for naked functions. testsuite/ChangeLog: PR target/81639 * gcc.target/i386/pr81639.c: New test. From-SVN: r250768 --- gcc/ChangeLog | 20 ++++++++++++++------ gcc/config/i386/i386.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr81639.c | 12 ++++++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr81639.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f48f0cc2379..bb56487bdff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-08-01 Uros Bizjak + + PR target/81639 + * config/i386/i386.c (ix86_funciton_naked): New prototype. + (ix86_function_ok_for_sibcall): Return false for naked functions. + 2017-08-01 Richard Biener * tree-ssa-pre.c (print_pre_expr): Handle NULL expr. @@ -187,14 +193,16 @@ vector double vec_xl_be (signed long long, double *); vector float vec_xl_be (signed long long, float *); * config/rs6000/altivec.h (vec_xl_be): Add #define. - * config/rs6000/rs6000-builtin.def (XL_BE_V16QI, XL_BE_V8HI, XL_BE_V4SI, - XL_BE_V2DI, XL_BE_V4SF, XL_BE_V2DF, XL_BE): Add definitions for the builtins. + * config/rs6000/rs6000-builtin.def (XL_BE_V16QI, XL_BE_V8HI, XL_BE_V4SI) + XL_BE_V2DI, XL_BE_V4SF, XL_BE_V2DF, XL_BE): Add definitions + for the builtins. * config/rs6000/rs6000.c (altivec_expand_xl_be_builtin): Add function. - (altivec_expand_builtin): Add switch statement to call altivec_expand_xl_be - for each builtin. + (altivec_expand_builtin): Add switch statement to call + altivec_expand_xl_be for each builtin. (altivec_init_builtins): Add def_builtin for _builtin_vsx_le_be_v8hi, - __builtin_vsx_le_be_v4si, __builtin_vsx_le_be_v2di, __builtin_vsx_le_be_v4sf, - __builtin_vsx_le_be_v2df, __builtin_vsx_le_be_v16qi. + __builtin_vsx_le_be_v4si, __builtin_vsx_le_be_v2di, + __builtin_vsx_le_be_v4sf, __builtin_vsx_le_be_v2df, + __builtin_vsx_le_be_v16qi. * doc/extend.texi: Update the built-in documentation file for the new built-in functions. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a115c4cc31b..27011c38a45 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -94,6 +94,7 @@ static rtx legitimize_pe_coff_extern_decl (rtx, bool); static rtx legitimize_pe_coff_symbol (rtx, bool); static void ix86_print_operand_address_as (FILE *, rtx, addr_space_t, bool); static bool ix86_save_reg (unsigned int, bool, bool); +static bool ix86_function_naked (const_tree); #ifndef CHECK_STACK_LIMIT #define CHECK_STACK_LIMIT (-1) @@ -7929,6 +7930,9 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) rtx a, b; bool bind_global = decl && !targetm.binds_local_p (decl); + if (ix86_function_naked (current_function_decl)) + return false; + /* Sibling call isn't OK if there are no caller-saved registers since all registers must be preserved before return. */ if (cfun->machine->no_caller_saved_registers) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c901efbcef1..5c21b681ae8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-01 Uros Bizjak + + PR target/81639 + * gcc.target/i386/pr81639.c: New test. + 2017-08-01 Richard Biener * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust. diff --git a/gcc/testsuite/gcc.target/i386/pr81639.c b/gcc/testsuite/gcc.target/i386/pr81639.c new file mode 100644 index 00000000000..da2211532eb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81639.c @@ -0,0 +1,12 @@ +/* PR target/81639 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void b (void); + +void +__attribute__ ((naked)) +a (void) +{ + b (); +} -- 2.30.2