Skip Menu |
Report information
Id: 129785
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cookbook_000 [at] yahoo.co.jp <titsuki [at] cpan.org>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: cookbook_000 [...] yahoo.co.jp
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Subject: [BUG][NATIVECALL] Cannot assign ULLONG_MAX (i.e. 18446744073709551615) to the ulonglong variable.
Date: Sun, 2 Oct 2016 17:10:39 +0900 (JST)
Download (untitled) / with headers
text/plain 893b
See the following results:

$ gcc ulonglong.c
$ ./a.out
unsigned long long max: 18446744073709551615

$ perl6 -MNativeCall -e 'my ulonglong $a = 18446744073709551615; say $a;'
-1

$ perl6 -MNativeCall -e 'my longlong $a = 18446744073709551615; say $a;'
-1

ulongulong.c
--------------------
#include <stdio.h>
#include <limits.h>

int main(){
  printf("unsigned long long max: %llu\n", ULLONG_MAX);
}
--------------------

It seems wrong to me, because ulonglong behaves like longlong and returns signed variables.

$ perl6 --version
This is Rakudo version 2016.09-105-g4abc28c built on MoarVM version 2016.09-13-g34c375a
implementing Perl 6.c.

$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org