www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12251] New: Use of BigInts in triple operator too

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251

           Summary: Use of BigInts in triple operator too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-02-25 04:58:55 PST ---
import std.stdio, std.bigint;
bool b;
void main() {
    int x1, x2;
    (b ? x1 : x2) += 1;
    writeln(x1, " ", x2);
    BigInt y1, y2;
    (b ? y1 : y2) += 1;
    writeln(y1, " ", y2);
}


Output:
0 1
0 0


Expected output:
0 1
0 1

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


safety0ff.bugz <safety0ff.bugz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz gmail.com


--- Comment #1 from safety0ff.bugz <safety0ff.bugz gmail.com> 2014-02-25
10:07:46 PST ---
I think this is a wrong-code bug and not a phobos enhancement. If we manually
change the the BigInts to lvalues we see the correct output.

------ Example -----
import std.stdio, std.bigint;
bool b;
void main() {
    int x1, x2;
    (b ? x1 : x2) += 1;
    writeln(x1, " ", x2);

    BigInt y1, y2;
    (b ? y1 : y2) += 1;
    writeln(y1, " ", y2);

    BigInt z1, z2;
    *(b ? &z1 : &z2) += 1;
    writeln(z1, " ", z2);
}
------ Output -----
0 1
0 0
0 1

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


--- Comment #2 from bearophile_hugs eml.cc 2014-02-25 10:39:30 PST ---
(In reply to comment #1)
 I think this is a wrong-code bug and not a phobos enhancement.

OK, changed to a normal bug. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m
          Component|Phobos                      |DMD


--- Comment #3 from Peter Alexander <peter.alexander.au gmail.com> 2014-02-25
13:08:54 PST ---
Also, changing the "b" to "false" fixes the issue, so it is definitely code
gen. I've updated the component to DMD so the right people see this.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251



--- Comment #4 from safety0ff.bugz <safety0ff.bugz gmail.com> 2014-02-26
01:00:57 PST ---
(In reply to comment #3)
 Also, changing the "b" to "false" fixes the issue, so it is definitely code
 gen.

Looks more like a front end issue to me: the output doesn't change between compilers and compiler settings. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #5 from yebblies <yebblies gmail.com> 2014-03-01 00:34:22 EST ---
This appears to be fixed.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #6 from bearophile_hugs eml.cc 2014-02-28 10:00:30 PST ---
(In reply to comment #5)
 This appears to be fixed.

Yes, closed. But I'd like to know what has fixed this issue (and perhaps some tests could be added to keep this fixed). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 28 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12251


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME


--- Comment #7 from yebblies <yebblies gmail.com> 2014-03-01 05:06:49 EST ---
That's a good idea.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 28 2014