Author: luporl
Date: Wed Feb 13 18:28:53 2019
New Revision: 344109
URL: https://svnweb.freebsd.org/changeset/base/344109

Log:
  silence cast-align warnings from clang on powerpc64
  
  silence the following warning when compiling libthr with clang 8
  for powerpc64 architecture:
  
  usr/src/lib/libthr/arch/powerpc/include/pthread_md.h:82:10: error:
  cast from 'uint8_t *' (aka 'unsigned char *') to 'struct tcb *'
  increases required alignment from 1 to 8 [-Werror,-Wcast-align]
  82:  return ((struct tcb *)(_tp - TP_OFFSET));
  
  Submitted by: alfredo.junior_eldorado.org.br
  Reviewed by:  git_bdragon.rtk0.net, emaste, kib, jhibbits, luporl
  Differential Revision:        https://reviews.freebsd.org/D18807

Modified:
  head/lib/libthr/arch/powerpc/include/pthread_md.h

Modified: head/lib/libthr/arch/powerpc/include/pthread_md.h
==============================================================================
--- head/lib/libthr/arch/powerpc/include/pthread_md.h   Wed Feb 13 17:50:01 
2019        (r344108)
+++ head/lib/libthr/arch/powerpc/include/pthread_md.h   Wed Feb 13 18:28:53 
2019        (r344109)
@@ -72,14 +72,15 @@ _tcb_set(struct tcb *tcb)
 static __inline struct tcb *
 _tcb_get(void)
 {
-       register uint8_t *_tp;
+        register struct tcb *tcb;
+
 #ifdef __powerpc64__
-       __asm __volatile("mr %0,13" : "=r"(_tp));
+       __asm __volatile("addi %0,13,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
 #else
-       __asm __volatile("mr %0,2" : "=r"(_tp));
+       __asm __volatile("addi %0,2,%1" : "=r"(tcb) : "i"(-TP_OFFSET));
 #endif
 
-       return ((struct tcb *)(_tp - TP_OFFSET));
+       return (tcb);
 }
 
 static __inline struct pthread *
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to