public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, libgfortran]: Avoid left shift of negative value warning
@ 2015-07-29 12:03 Uros Bizjak
  2015-07-29 15:38 ` FX
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2015-07-29 12:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Fortran List

Attached patch rewrites GFC_DTYPE_SIZE_MASK definition to avoid "left
shift of negative value" warning. during ligfortran build.

2015-07-29  Uros Bizjak  <ubizjak@gmail.com>

    PR libgfortran/66650
    * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid
    "left shift of negative value" warning.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline and release branches?

Uros.

---
Index: libgfortran.h
===================================================================
--- libgfortran.h       (revision 226339)
+++ libgfortran.h       (working copy)
@@ -404,8 +404,7 @@

/* Macros to get both the size and the type with a single masking operation  */

-#define GFC_DTYPE_SIZE_MASK \
-  ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT)
+#define GFC_DTYPE_SIZE_MASK (-((index_type) 1 << GFC_DTYPE_SIZE_SHIFT))
#define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK | GFC_DTYPE_TYPE_MASK)

#define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype & GFC_DTYPE_TYPE_SIZE_MASK)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, libgfortran]: Avoid left shift of negative value warning
  2015-07-29 12:03 [PATCH, libgfortran]: Avoid left shift of negative value warning Uros Bizjak
@ 2015-07-29 15:38 ` FX
  0 siblings, 0 replies; 2+ messages in thread
From: FX @ 2015-07-29 15:38 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, Fortran List

> 2015-07-29  Uros Bizjak  <ubizjak@gmail.com>
> 
>    PR libgfortran/66650
>    * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid
>    "left shift of negative value" warning.

OK. Thanks for the patch.

FX

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-29 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 12:03 [PATCH, libgfortran]: Avoid left shift of negative value warning Uros Bizjak
2015-07-29 15:38 ` FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).