poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug Compiler/26924] New: Incorrect handling of big numbers


From: m.nabipoor at yahoo dot com
Subject: [Bug Compiler/26924] New: Incorrect handling of big numbers
Date: Fri, 20 Nov 2020 01:35:35 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26924

            Bug ID: 26924
           Summary: Incorrect handling of big numbers
           Product: poke
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: Compiler
          Assignee: unassigned at sourceware dot org
          Reporter: m.nabipoor at yahoo dot com
                CC: poke-devel at gnu dot org
  Target Milestone: ---

Hi.


=== Issue 1


This is correct:

```poke
(poke) var x = -1 as uint64
(poke) x
18446744073709551615UL
(poke) x < 1
0
```

But this is not:

```poke
(poke) 18446744073709551615UL < 1
1
(poke) 18446744073709551615UL < 1UL
1
```

And using libpoke C API triggers an assertion:

```c
pk_val val;

pk_compile_expression (pkc, "18446744073709551615UL < 1UL", NULL, &val);
```

```
a.out: ../../libpoke/pkl-ast.c:357: pkl_ast_make_integral_type: Assertion
`signed_p == 0 || signed_p == 1' failed.
Aborted (core dumped)

```



=== Issue 2

IMHO this should be a compile-time error:

```
(poke) var x = 18446744073709551615
(poke) x
-1L
```

In Poke, this integer literal is invalid. There's no such a signed number.
Even C compilers (both gcc and clang) emit warning!


Regards,
Mohammad-Reza

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]