This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/2614: Error when calculating with long long int
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/2614: Error when calculating with long long int
- From: jacob dot schultz at barconet dot com
- Date: 23 Apr 2001 14:07:29 -0000
- Reply-To: jacob dot schultz at barconet dot com
>Number: 2614
>Category: c
>Synopsis: Error when calculating with long long int
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 23 07:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: jacob.schultz@barconet.com
>Release: gcc-2.95.3
>Organization:
>Environment:
Linux, Cygwin
>Description:
There seems to be a problem when calculating with long longs. In a program I need to mask a number of bits from a long long, but something goes wrong. The calculation
((1<<n)-1)&m returns zero when n is 32 or larger, even if bits are set in m. Both n and m are unsigned long long int.
I've attached an example which illustrates the pwoblem.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: