www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7156] New: ICE with 199 or 200 repeated integer increments w/ optimisation

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

           Summary: ICE with 199 or 200 repeated integer increments w/
                    optimisation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: peter.alexander.au gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au gmail.com> 2011-12-22
14:53:02 PST ---
This is a bit of a bizarre one. If you have 199 or 200 repeated integer
increments then you get an ICE when optimisations are enabled.

string rep(string s, int n)
{
    return n > 1 ? s ~ rep(s, n-1) : s;
}

void main()
{
    int i;
    version (A) mixin(rep("++i;", 198));
    version (B) mixin(rep("++i;", 199));
    version (C) mixin(rep("++i;", 200));
    version (D) mixin(rep("++i;", 201));
}


% time dmd test.d -O -version=A
dmd test.d -O -version=A  0.53s user 0.03s system 80% cpu 0.687 total

% time dmd test.d -O -version=B
Internal error: ../ztc/go.c 242
dmd test.d -O -version=B  0.49s user 0.01s system 95% cpu 0.528 total

% time dmd test.d -O -version=C
Internal error: ../ztc/go.c 242
dmd test.d -O -version=C  0.50s user 0.01s system 92% cpu 0.547 total

% time dmd test.d -O -version=D
dmd test.d -O -version=D  0.54s user 0.03s system 93% cpu 0.613 total


Notice the internal errors in versions B and C, but not A or D.

With no -O flag, there is no ICE in any version.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7156


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Platform|x86                         |All
         OS/Version|Mac OS X                    |All


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2013-10-05
21:19:18 PDT ---
What's happening is the optimizer has a check for going into an infinite loop,
because sometimes two optimization states will flip-flop back and forth instead
of converging on a solution.

Although this isn't an infinite loop case, the optimizer can't tell that.

The assert trip is line 241 of go.c.

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



--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2013-10-05
22:49:59 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2634

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



--- Comment #3 from github-bugzilla puremagic.com 2013-10-06 20:20:35 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac270ba6eea47985d7373bb0a810de390a0844eb
fix Issue 7156 - ICE(go.c): with 199 or 200 repeated integer increments, only
with -O

https://github.com/D-Programming-Language/dmd/commit/a3743bc645fc065104470cdecbd64e3f14034fdf
Merge pull request #2634 from WalterBright/fix7156

fix Issue 7156 - ICE(go.c): with 199 or 200 repeated integer increments,...

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



--- Comment #4 from github-bugzilla puremagic.com 2013-10-06 20:26:51 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2452bf64f89795e7e1ae46a3062a44f258e5d3ac
Merge pull request #2634 from WalterBright/fix7156

fix Issue 7156 - ICE(go.c): with 199 or 200 repeated integer increments,...

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
            Version|D2                          |D1 & D2
         Resolution|                            |FIXED


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