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

            Bug ID: 86055
           Summary: Bitshifts temporarly change uint32_t to int32_t on
                    x86_64 Mac OS
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guicrith at gmail dot com
  Target Milestone: ---

Created attachment 44238
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44238&action=edit
Simple test program source, no dependancys.

Right-shifting a negative value is implementation-defined and not recommended
by good coding practice. Wikipedia
The same behavior is occuring with a uint32_t, but it should be impossible for
it to be negative.
Under the existing C rules uint16_t should be promoted to int64_t(the native
int type for x86_64) before bitshifting.
It seems to be taking the signed part of int64_t without the 64 bits part.

x86_64 Mac OS 10.13.5 gcc version 8.1.0 (Homebrew GCC 8.1.0)

Reply via email to