[Patch] PR71017 - libgcc/config/i386/cpuinfo.c:346:17: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Dominique d'Humières dominiq@lps.ens.fr
Sat Jan 7 13:14:00 GMT 2017


The following patch fixes errors of the kind

libgcc/config/i386/cpuinfo.c:260:17: runtime error: left shift of 1 by 31 places cannot be represented in type ‘int'

2017-01-07  Dominique d'Humieres  <dominiq@lps.ens.fr>

        PR target/71017
        * config/i386/cpuid.h: Fix undefined behavior.

--- ../_clean/gcc/config/i386/cpuid.h	2017-01-01 17:39:04.000000000 +0100
+++ gcc/config/i386/cpuid.h	2017-01-05 15:22:31.000000000 +0100
@@ -91,7 +91,7 @@
 #define bit_AVX512CD	(1 << 28)
 #define bit_SHA		(1 << 29)
 #define bit_AVX512BW	(1 << 30)
-#define bit_AVX512VL	(1 << 31)
+#define bit_AVX512VL	(1u << 31)
 
 /* %ecx */
 #define bit_PREFETCHWT1	  (1 << 0)

Is it OK for trunk/branches?

TIA

Dominique



More information about the Gcc-patches mailing list