[Committed] Correct testcase gcc.target/bfin/20090914-3.c

Message ID 007d01d7c8db$6cea81e0$46bf85a0$@nextmovesoftware.com
State Committed
Commit 9d1727a30e4b3e02f20e310d8e1fe2a6944883be
Headers
Series [Committed] Correct testcase gcc.target/bfin/20090914-3.c |

Commit Message

Roger Sayle Oct. 24, 2021, 1:31 p.m. UTC
  This patch cures the testsuite failure of bfin/20090914-3.c, which
currently FAILs on bfin-elf with "(test for excess errors)" due to:
20090914-3.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
which is obviously not what this code was intended to test.  Fixed by
turning the code into a function returning the final "fract32" result,
as simply specifying an "int" return type for main, results in the
entire function being optimized away, as the result is unused.

Checked-in as obvious.


2021-10-24  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
	* gcc.target/bfin/20090914-3.c: Tweak test case.

Roger
--
  

Patch

diff --git a/gcc/testsuite/gcc.target/bfin/20090914-3.c b/gcc/testsuite/gcc.target/bfin/20090914-3.c
index fb0a9e1..6be5528 100644
--- a/gcc/testsuite/gcc.target/bfin/20090914-3.c
+++ b/gcc/testsuite/gcc.target/bfin/20090914-3.c
@@ -1,10 +1,11 @@ 
 /* { dg-do compile { target bfin-*-* } } */
 typedef long fract32;
-main() {
+fract32 foo() {
   fract32 val_tmp;
   fract32 val1 = 0x7FFFFFFF;
   fract32 val2 = 0x40000000;
   val_tmp = __builtin_bfin_mult_fr1x32x32 (0x06666667, val1);
   val2 = __builtin_bfin_mult_fr1x32x32 (0x79999999, val2);
   val2 = __builtin_bfin_add_fr1x32 (val_tmp, val2);
+  return val2;
 }