This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Obsolete matherr, _LIB_VERSION, libieee.a


On Mon, 21 Aug 2017, Adhemerval Zanella wrote:

> Joseph I am seeing the failure:
> 
> ../sysdeps/ieee754/k_standard.c: In function ‘__kernel_standard’:
> ../sysdeps/ieee754/k_standard.c:943:12: error: ‘exc.retval’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   return exc.retval;
>          ~~~^~~~~~~
> When building 'math/k_standard.o' with GCC 7.1.1 and 8.0.0 (built 
> with build-many-glibcs.py). with patch on master. GCC 5.4/6.2.1 does 
> not show this issue.

Thanks for pointing this out (my testing was with GCC 6).  I've committed 
this patch to use __builtin_unreachable in a default case to avoid this 
error.

Fix GCC 7 build of k_standard.c.

This patch adds a default case to k_standard.c that calls
__builtin_unreachable, to avoid an uninitialized variable error from
GCC 7 (reported in
<https://sourceware.org/ml/libc-alpha/2017-08/msg01012.html>).

Tested for x86_64 (with GCC 7).

2017-08-21  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/ieee754/k_standard.c (__kernel_standard): Add default
	case calling __builtin_unreachable.

diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index 0a0201f..8f906bd 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -939,6 +939,9 @@ __kernel_standard(double x, double y, int type)
 		break;
 
 		/* #### Last used is 50/150/250 ### */
+
+	    default:
+		__builtin_unreachable ();
 	}
 	return exc.retval;
 }

-- 
Joseph S. Myers
joseph@codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]