This code from builtins.c:

  /* If we don't need too much alignment, we'll have been guaranteed
     proper alignment by get_trampoline_type.  */
  if (TRAMPOLINE_ALIGNMENT <= STACK_BOUNDARY)
    return tramp;


It's entirely conceivable that TRAMPOLINE_ALIGNMENT will be the same as STACK_BOUNDARY. And if they are, then -Wtautological-compare will complain bitterly.

This affects the cr16 port and possibly others (I've had this fix in my tree while running the config-all.mk builds).

Given the real possibility that those two objects are the same and thus the complaint from -Wtautological-compare, it seems best to simply disable -Wtautological-compare for this function.

Bootstrapped and regression tested on x86_64-linux-gnu and also used to successfully build cr16-elf cross compilers from config-all.mk.

OK for the trunk?

Other alternatives would be to obfuscate the appropriate macros in the cr16 port. That seemed wrong in this case to me.

Jeff
        * builtins.c (round_trampoline_addr): Turn off -Wtautological-compare
        when compiling this function.

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1592810..e4ed470 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4830,6 +4830,11 @@ expand_builtin___clear_cache (tree exp)
   return const0_rtx;
 }
 
+#if GCC_VERSION >= 6000
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtautological-compare"
+#endif
+
 /* Given a trampoline address, make sure it satisfies TRAMPOLINE_ALIGNMENT.  */
 
 static rtx
@@ -4854,6 +4859,9 @@ round_trampoline_addr (rtx tramp)
 
   return tramp;
 }
+#if GCC_VERSION >= 6000
+#pragma GCC diagnostic pop
+#endif
 
 static rtx
 expand_builtin_init_trampoline (tree exp, bool onstack)

Reply via email to