www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10018] New: Value range propagation for immutable variables

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

           Summary: Value range propagation for immutable variables
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: lio+bugzilla lunesu.com


--- Comment #0 from Lionello Lunesu <lio+bugzilla lunesu.com> 2013-05-02
11:39:08 PDT ---
immutable int i = 1;    //range from initializer does not propagate

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018



--- Comment #1 from Lionello Lunesu <lio+bugzilla lunesu.com> 2013-05-02
12:32:38 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1955

Not sure how to test this. There's no [portable] way of testing whether a range
is being propagated, is there?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-05-02
12:33:18 PDT ---
I don't understand the bug, what's the issue here?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018



--- Comment #3 from Lionello Lunesu <lio+bugzilla lunesu.com> 2013-05-02
17:35:02 PDT ---
(In reply to comment #2)
 I don't understand the bug, what's the issue here?
Any calculation with 'i' that uses VRP get the full int range, not the constant 1. The same holds for 'const int'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018


Lionello Lunesu <lio+bugzilla lunesu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P4


--- Comment #4 from Lionello Lunesu <lio+bugzilla lunesu.com> 2013-05-02
18:16:16 PDT ---
Degrading to P4, since in many cases, calling optimize() on the Expression
before doing getIntRange() will in fact return the constant range. 

Not closing until I've identified that indeed implementing
VarExp::getIntRange() would NOT have any effect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #5 from bearophile_hugs eml.cc 2013-07-10 04:43:10 PDT ---
(In reply to comment #1)
 https://github.com/D-Programming-Language/dmd/pull/1955
This is a good improvement for D. I hope you will fix and reopen your patch. But I think this issue should be tagged as "enhancement". See also Issue 10594 for an "improvement" of this idea. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10018



--- Comment #6 from bearophile_hugs eml.cc 2013-07-20 13:58:03 PDT ---
Se also Issue 10685 , Issue 10615 , Issue 10594

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 20 2013