Bug 84932 - [8 Regression] i386/cpuinfo.h:293: 4 * bad bitshifts ?
Summary: [8 Regression] i386/cpuinfo.h:293: 4 * bad bitshifts ?
Status: RESOLVED DUPLICATE of bug 84945
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: ubsan
  Show dependency treegraph
 
Reported: 2018-03-18 18:09 UTC by David Binderman
Modified: 2018-03-19 10:40 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-*-*, i?86-*-*
Build:
Known to work:
Known to fail: 8.0
Last reconfirmed: 2018-03-18 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2018-03-18 18:09:31 UTC
[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.
Comment 1 David Binderman 2018-03-18 18:29:23 UTC
Revision 258551 looks related. 

Maybe Julia can offer some assistance with this possible problem.
Comment 2 Martin Liška 2018-03-18 19:09:04 UTC
Confirmed.
Comment 3 Jakub Jelinek 2018-03-19 10:40:47 UTC
Dup.

*** This bug has been marked as a duplicate of bug 84945 ***