https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84932

            Bug ID: 84932
           Summary: i386/cpuinfo.h:293: 4 *  bad bitshifts ?
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

[trunk/libgcc/config/i386/cpuinfo.c:293]: (error) Shifting 32-bit value by 32
bits is undefined behaviour
[trunk/libgcc/config/i386/cpuinfo.c:295]: (error) Shifting 32-bit value by 33
bits is undefined behaviour
[trunk/libgcc/config/i386/cpuinfo.c:297]: (error) Shifting 32-bit value by 34
bits is undefined behaviour
[trunk/libgcc/config/i386/cpuinfo.c:299]: (error) Shifting 32-bit value by 35
bits is undefined behaviour

Source code is

      if (ecx & bit_GFNI)
        features |= (1 << FEATURE_GFNI);
      if (ecx & bit_VPCLMULQDQ)
        features |= (1 << FEATURE_VPCLMULQDQ);
      if (ecx & bit_AVX512VNNI)
        features |= (1 << FEATURE_AVX512VNNI);
      if (ecx & bit_AVX512BITALG)
        features |= (1 << FEATURE_AVX512BITALG);

There are more than 32 features. 1UL would be a better bitmask.
Local variable "features" could do with moving from int to size_t.

Reply via email to