Skip Menu |
Report information
Id: 127144
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: juerd [at] tnx.nl
Cc:
AdminCc:

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



Subject: Native uint doesn't overflow on ++
Date: Mon, 4 Jan 2016 00:25:30 +0100
From: "Juerd Waalboer" <juerd [...] tnx.nl>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 495b
Bug: Show quoted text
> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
255 -> 0 Work as expected: Show quoted text
> my uint8 $x = 256; say $x
0 Show quoted text
> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
255 -> 0 Show quoted text
> my int8 $x = 127; print $x, " -> "; $x++; say $x;
127 -> -128 I'd like to contribute tests for this; where in roast should I put them? Please suggest a filename :-) -- Met vriendelijke groet, // Kind regards, // Korajn salutojn, Juerd Waalboer <juerd@tnx.nl> TNX
Download (untitled) / with headers
text/plain 147b
S02-types/native.t would seem a ood place for testing scalar sized uints. A couple blocks below the tests for 124084 are some comparable tests.
From: "Juerd Waalboer" <juerd [...] tnx.nl>
To: rakudobug [...] perl.org
Date: Mon, 4 Jan 2016 01:58:59 +0100
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Download (untitled) / with headers
text/plain 347b
Juerd Waalboer skribis 2016-01-04 0:25 (+0100): Show quoted text
> Bug:
> > my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> 255 -> 0
Ahem, that's not the bug. This is: Show quoted text
> my uint8 $x = 255; print $x, " -> "; $x++; say $x;
255 -> 256 -- Met vriendelijke groet, // Kind regards, // Korajn salutojn, Juerd Waalboer <juerd@tnx.nl> TNX
From: "Juerd Waalboer" <juerd [...] tnx.nl>
To: "Brian S. Julin via RT" <perl6-bugs-followup [...] perl.org>
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Date: Mon, 4 Jan 2016 01:57:18 +0100
Download (untitled) / with headers
text/plain 816b
Brian S. Julin via RT skribis 2016-01-03 15:37 (-0800): Show quoted text
> S02-types/native.t would seem a ood place for testing scalar sized uints.
Thanks. Unfortunately, I couldn't easily figure out how to write TODO tests. So here's something that someone could copy and paste: # RT #127144, uint increment in sink context { sub d { "++ on uint$^n overflows to 0 in sink context" } my uint8 $uint8 = 0xff; $uint8++; is($uint8, 0, d 8); my uint16 $uint16 = 0xffff; $uint16++; is($uint16, 0, d 16); my uint32 $uint32 = 0xffffffff; $uint32++; is($uint32, 0, d 32); my uint64 $uint64 = 0xffffffffffffffff; $uint64++; is($uint64, 0, d 64); } -- Met vriendelijke groet, // Kind regards, // Korajn salutojn, Juerd Waalboer <juerd@tnx.nl> TNX
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: "Juerd Waalboer (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Mon, 4 Jan 2016 11:37:38 +0100
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Download (untitled) / with headers
text/plain 770b
Show quoted text
> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Juerd Waalboer > # Please include the string: [perl #127144] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 > > > > Bug: >
>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> 255 -> 0 > > Work as expected: >
>> my uint8 $x = 256; say $x
> 0
>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> 255 -> 0
>> my int8 $x = 127; print $x, " -> "; $x++; say $x;
> 127 -> -128 > > I'd like to contribute tests for this; where in roast should I put them? > Please suggest a filename :-)
t/spec/S02-types/native.t probably. Liz
CC: "Juerd Waalboer (via RT)" <perl6-bugs-followup [...] perl.org>
To: Elizabeth Mattijsen <liz [...] dijkmat.nl>
From: Bart Wiegmans <bartwiegmans [...] gmail.com>
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Date: Mon, 4 Jan 2016 11:48:02 +0100
Just speculating, but I think this can be fixed by codegen; to be specific, the inc_i op should be followed by a truncate in case of a sized variable.

2016-01-04 11:37 GMT+01:00 Elizabeth Mattijsen <liz@dijkmat.nl>:
Show quoted text
> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs-followup@perl.org> wrote:
>
> # New Ticket Created by  Juerd Waalboer
> # Please include the string:  [perl #127144]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 >
>
>
> Bug:
>
>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
>    255 -> 0
>
> Work as expected:
>
>> my uint8 $x = 256; say $x
>    0
>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
>    255 -> 0
>> my int8 $x = 127; print $x, " -> "; $x++; say $x;
>    127 -> -128
>
> I'd like to contribute tests for this; where in roast should I put them?
> Please suggest a filename :-)

t/spec/S02-types/native.t probably.




Liz

To: "Juerd Waalboer (via RT)" <perl6-bugs-followup [...] perl.org>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Date: Mon, 4 Jan 2016 11:48:33 +0100
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Download (untitled) / with headers
text/plain 494b
Show quoted text
> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Juerd Waalboer > # Please include the string: [perl #127144] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 > > > > Bug: >
>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> 255 -> 0
What is the bug here??? Looks to me it’s entirely doing what is expected? Liz
To: perl6-compiler [...] perl.org
From: Tobias Leich <email [...] froggs.de>
Subject: Re: [perl #127144] Native uint doesn't overflow on ++
Date: Mon, 4 Jan 2016 13:14:24 +0100
Download (untitled) / with headers
text/plain 788b
That highlights the bug: m: my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x; rakudo-moar 0f26ae: OUTPUT«255 -> 0␤» m: my uint8 $x = 255; print $x, " -> "; $x++; say $x; rakudo-moar 0f26ae: OUTPUT«255 -> 256␤» Am 04.01.2016 um 11:48 schrieb Elizabeth Mattijsen: Show quoted text
>> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs-followup@perl.org> wrote: >> >> # New Ticket Created by Juerd Waalboer >> # Please include the string: [perl #127144] >> # in the subject line of all future correspondence about this issue. >> # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 > >> >> >> Bug: >>
>>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
>> 255 -> 0
> What is the bug here??? Looks to me it’s entirely doing what is expected? > > > > Liz
This no longer prints 256.

Bisectable points to https://github.com/rakudo/rakudo/commit/5401a1aa8f12c360ccd3e4000dcdc65ad98c746a

Is it actually resolved or not?

I will mark it testneeded for now (if it's not resolved, the tests should reveal it).

On 2016-01-04 04:14:49, FROGGS.de wrote:
Show quoted text
> That highlights the bug:
>
> m: my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> rakudo-moar 0f26ae: OUTPUT«255 -> 0␤»
>
> m: my uint8 $x = 255; print $x, " -> "; $x++; say $x;
> rakudo-moar 0f26ae: OUTPUT«255 -> 256␤»
>
> Am 04.01.2016 um 11:48 schrieb Elizabeth Mattijsen:
> >> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs-
> >> followup@perl.org> wrote:
> >>
> >> # New Ticket Created by Juerd Waalboer
> >> # Please include the string: [perl #127144]
> >> # in the subject line of all future correspondence about this issue.
> >> # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 >
> >>
> >>
> >> Bug:
> >>
> >>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> >> 255 -> 0
> > What is the bug here??? Looks to me it’s entirely doing what is
> > expected?
> >
> >
> >
> > Liz


Download (untitled) / with headers
text/plain 1.4k
On Fri, 07 Apr 2017 19:16:17 -0700, alex.jakimenko@gmail.com wrote: Show quoted text
> This no longer prints 256. > > Bisectable points to > https://github.com/rakudo/rakudo/commit/5401a1aa8f12c360ccd3e4000dcdc65ad98c746a > > Is it actually resolved or not? > > I will mark it testneeded for now (if it's not resolved, the tests > should > reveal it). > > On 2016-01-04 04:14:49, FROGGS.de wrote:
> > That highlights the bug: > > > > m: my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x; > > rakudo-moar 0f26ae: OUTPUT«255 -> 0␤» > > > > m: my uint8 $x = 255; print $x, " -> "; $x++; say $x; > > rakudo-moar 0f26ae: OUTPUT«255 -> 256␤» > > > > Am 04.01.2016 um 11:48 schrieb Elizabeth Mattijsen:
> > >> On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) <perl6-bugs- > > >> followup@perl.org> wrote: > > >> > > >> # New Ticket Created by Juerd Waalboer > > >> # Please include the string: [perl #127144] > > >> # in the subject line of all future correspondence about this > > >> issue. > > >> # <URL: https://rt.perl.org/Ticket/Display.html?id=127144 > > > >> > > >> > > >> Bug: > > >>
> > >>> my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
> > >> 255 -> 0
> > > What is the bug here??? Looks to me it’s entirely doing what is > > > expected? > > > > > > > > > > > > Liz
Turns out the the tests listed above where added to roast with https://github.com/perl6/roast/commit/c824a98985b739f2a0fa03aa144f2d7c7fb3606c Closing issue


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