re PR target/81639 (ICE in rtl_verify_bb_insns, at cfgrtl.c:2669 with a naked function)
authorUros Bizjak <uros@gcc.gnu.org>
Tue, 1 Aug 2017 10:57:55 +0000 (12:57 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 1 Aug 2017 10:57:55 +0000 (12:57 +0200)
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
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr81639.c [new file with mode: 0644]

index f48f0cc237966da0672591f881ca5dfc8505e4e5..bb56487bdff36b9dae22f2a26221a776399f5f04 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-01  Uros Bizjak  <ubizjak@gmail.com>
+
+       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  <rguenther@suse.de>
 
        * tree-ssa-pre.c (print_pre_expr): Handle NULL expr.
        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.
 
index a115c4cc31bdddc14ff45d2ce33db703149d9201..27011c38a45f07c844669a38d32fd68dd67b025f 100644 (file)
@@ -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)
index c901efbcef12bcd3f5f878b8a23ae5c7cd9429c2..5c21b681ae8bf619b9a7c0306df1bae7bf894a52 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-01  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/81639
+       * gcc.target/i386/pr81639.c: New test.
+
 2017-08-01  Richard Biener  <rguenther@suse.de>
 
        * 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 (file)
index 0000000..da22115
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR target/81639 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void b (void);
+
+void
+__attribute__ ((naked))
+a (void)
+{
+  b ();
+}