PR64606 reports several warnings when building the arm target
libgcc.  The -Wmissing-prototypes warnings in config/arm/fp16.c have
since been fixed (the internal helpers are now static inline and the
public functions have prototypes), leaving one -Wcast-qual warning:

unwind-arm-common.inc: In function get_eit_entry:
unwind-arm-common.inc:245:29: warning: cast discards const
qualifier from pointer target type [-Wcast-qual]
       ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *)&eitp->content;

The type of the ehtp field is fixed by the EHABI so it cannot be made
const; launder the cast through _uw (matching the _uw <-> pointer
conversions already used for this field) to avoid the warning.

libgcc/ChangeLog:

        PR target/64606
        * unwind-arm-common.inc (get_eit_entry): Avoid -Wcast-qual
        warning when caching the immediate-data exception-handling
        table pointer.

Signed-off-by: Dominic P <[email protected]>
---
 libgcc/unwind-arm-common.inc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libgcc/unwind-arm-common.inc b/libgcc/unwind-arm-common.inc
index 38a67889a..7a716770e 100644
--- a/libgcc/unwind-arm-common.inc
+++ b/libgcc/unwind-arm-common.inc
@@ -368,8 +368,9 @@ get_eit_entry (_Unwind_Control_Block *ucbp, _uw 
return_address)
 
   if (eitp->content & uint32_highbit)
     {
-      /* It is immediate data.  */
-      ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *)&eitp->content;
+      /* It is immediate data.  Cast via _uw to avoid a warning about
+        casting away the const qualifier; ehtp is not written through.  */
+      ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *) (_uw) &eitp->content;
       ucbp->pr_cache.additional = 1;
     }
   else
-- 
2.55.0

Reply via email to