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

            Bug ID: 80825
           Summary: Result of a right-shift of a signed negative number
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: henry0312 at gmail dot com
  Target Milestone: ---

The result of a right-shift of a signed negative number has been changed
between 6.3.0 and 7.1.0.

I expect `a` to be positive, but `a` may be negative.

This issue will be happned with -O2 or -O3.

gcc 7.1.0
https://wandbox.org/permlink/hEn5goNhERtLNN5Q

gcc 6.3.0
https://wandbox.org/permlink/jVDXqdRjR6smHN0M


I guess that `& 0x7FFF` is ignogred in gcc 7.1.0.

Reply via email to