[Bug libfortran/66650] libgfortran: warning: left shift of negative value [-Wshift-negative-value]
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 29 11:49:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66650
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Patch that rewrites GFC_DTYPE_SIZE_MASK definition to avoid "left shift of
negative value" warning:
--cut here--
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)
--cut here--
More information about the Gcc-bugs
mailing list