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



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



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




 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



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




01:00:57 PST ---

 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



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




 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



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