As of the changes in context of PR65179, <http://news.gmane.org/find-root.php?message_id=%3C20150422183633.GI28950%40redhat.com%3E>, I'm seeing a bunch of -Wshift-negative-value warnings in the libgfortran build, for example: In file included from [...]/libgfortran/intrinsics/cshift0.c:26:0: [...]/libgfortran/intrinsics/cshift0.c: In function 'cshift0': [...]/libgfortran/libgfortran.h:408:48: warning: left shift of negative value [-Wshift-negative-value] ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT) ^ [...]/libgfortran/libgfortran.h:409:35: note: in expansion of macro 'GFC_DTYPE_SIZE_MASK' #define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK | GFC_DTYPE_TYPE_MASK) ^ [...]/libgfortran/libgfortran.h:411:52: note: in expansion of macro 'GFC_DTYPE_TYPE_SIZE_MASK' #define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype & GFC_DTYPE_TYPE_SIZE_MASK) ^ [...]/libgfortran/intrinsics/cshift0.c:94:15: note: in expansion of macro 'GFC_DTYPE_TYPE_SIZE' type_size = GFC_DTYPE_TYPE_SIZE (array); ^ Unless this will be resolved by demoting the warning (I have not reviewed the recent discussion, such as PR66066, <http://news.gmane.org/find-root.php?message_id=%3C20150511142112.GO3384%40redhat.com%3E>), I supposed this should be fixed in libgfortran/libgfortran.h, perhaps by making index_type an unsiged type if that's possible?
Confirmed for r222892 and more recent revisions, not present for r222830.
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--
Author: uros Date: Wed Jul 29 15:42:03 2015 New Revision: 226355 URL: https://gcc.gnu.org/viewcvs?rev=226355&root=gcc&view=rev Log: PR libgfortran/66650 * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid "left shift of negative value" warning. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/libgfortran.h
Author: uros Date: Wed Jul 29 17:12:28 2015 New Revision: 226357 URL: https://gcc.gnu.org/viewcvs?rev=226357&root=gcc&view=rev Log: PR libgfortran/66650 * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid "left shift of negative value" warning. Modified: branches/gcc-5-branch/libgfortran/ChangeLog branches/gcc-5-branch/libgfortran/libgfortran.h
Author: uros Date: Wed Jul 29 17:45:07 2015 New Revision: 226360 URL: https://gcc.gnu.org/viewcvs?rev=226360&root=gcc&view=rev Log: PR libgfortran/66650 * libgfortran.h (GFC_DTYPE_SIZE_MASK): Rewrite to avoid "left shift of negative value" warning. Modified: branches/gcc-4_9-branch/libgfortran/ChangeLog branches/gcc-4_9-branch/libgfortran/libgfortran.h
Fixed everywhere.