bugGNU Development Chain for 68HC11/68HC12 - Bugs: bug #30609, long long is not 64-bit as...


You are not allowed to post comments on this tracker with your current authentication level.

bug #30609: long long is not 64-bit as advertised, __uint64_t not 64-bit too

Submitter:  None
Submitted:  Sat 31 Jul 2010 12:44:27 AM UTC
Category:  gcc Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Wed 11 Aug 2010 12:26:35 AM UTC, comment #1: 

According to my investigation, there may not be a problem.  With the IAR Embedded Compiler, the integer constants work as shown.  However, with this Gnu compiler I need to put "ll" at the end of the 64-bit constants.  I guess this is acceptable for C, I haven't taken the time to look that up.

Also, for the multiplication, 64-bit multiplication results if I cast x to an unsigned long long in the line of code where the multiplication is invoked.

Craig Scratchley <scratchley>
Sat 31 Jul 2010 12:44:27 AM UTC, original submission:  

Hi.  Information on the compiler states:

long long
unsigned long long
Long long are 64-bit entities. They are never allocated in a hard register. They are passed on the stack for operations. They are returned like a struct (in memory). Logical operations (and, or, xor) are generated inline. Other operations are made by a library call. Some shift operations are generated inline.
63      55     47     39     31      23     15     7    0
|  7   |  6   |  5   |  4   |  3   |  2   |  1   |  0   |

However, I get the errors:

4 main.c
 warning: integer constant is too large for "long" type
9 main.c
 warning: integer constant is too large for "long" type

For the following program:

******* begin main.c *************
#include <sys/types.h>
#include <machine/types.h>

__uint64_t b =   0x11111111876;
u_int64_t a =   0x1111111187;

unsigned long int x =  0xffffffff;
unsigned long int y =  0xeeeeeeee;
unsigned long long z = 0x111111118;

int main ()
 z = x * y;
 return 0;
******* end main.c *************

Also, looking at the assembly generated (optimization turned off), the multiplication result doesn't seem to be 64 bit.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by scratchley (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code