www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10682] New: [ICE](cgcod.c line 1561) with ^^ operator

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

           Summary: [ICE](cgcod.c line 1561) with ^^ operator
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-07-20 11:06:06 PDT ---
void main() {
    ulong x = 1;
    ulong y = 2 ^^ x;
}


DMD 2.064alpha gives:

Internal error: backend\cgcod.c 1561

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


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx


--- Comment #1 from hsteoh quickfur.ath.cx 2013-08-30 11:45:05 PDT ---
Seems to have been fixed in git HEAD (46e495b), tested on Linux/64bit. Could
you verify if it's also fixed on Windows?

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



--- Comment #2 from hsteoh quickfur.ath.cx 2013-08-30 12:00:28 PDT ---
In fact, all versions of dmd from 2.063.2 up to commit
50a484a60cc3794281a98c51346fc0dfacfc0f24 (Fix Issue 5943 - Power expression
optimisation: 2^^unsigned ==> 1<<unsigned) displayed an error message of the
form:

    test.d(3): Error: must import std.math to use ^^ operator

and all versions thereafter (that I tested) simply compiles it with no error.
Maybe it was an intermittent failure that was quickly fixed, or maybe it only
happens with specific compiler flags, or maybe it's Windows-specific?

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



--- Comment #3 from bearophile_hugs eml.cc 2013-08-30 13:36:04 PDT ---
(In reply to comment #1)
 Seems to have been fixed in git HEAD (46e495b), tested on Linux/64bit. Could
 you verify if it's also fixed on Windows?
I see the same error (Windows 32, no compilation switches): Internal error: backend\cgcod.c 1561 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10682



--- Comment #4 from hsteoh quickfur.ath.cx 2013-08-30 13:48:35 PDT ---
OK, must be a Windows-specific problem then. Sorry, can't help you there (don't
have a Windows dev machine). :-(

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies gmail.com
         AssignedTo|nobody puremagic.com        |yebblies gmail.com
            Summary|[ICE](cgcod.c line 1561)    |[ICE](cgcod.c line 1561)
                   |with ^^ operator            |with ^^ operator and ulong
           Severity|major                       |regression


--- Comment #5 from yebblies <yebblies gmail.com> 2013-09-07 00:08:45 EST ---
A quick look shows that:

void main() {
    ulong x = 1;
    ulong y = 2 ^^ x;
}

Is expanded to:

ulong x = 1LU;
ulong y = 1LU << x * 1LU;
return 0;

while

void main() {
    ulong x = 1LU;
    ulong y = 1LU << x * 1LU;
}

is expanded to

ulong x = 1LU;
ulong y = 1LU << cast(int)(x * 1LU);
return 0;

And it seems the register allocator (or something) can't handle a ulong shift
amount.  Usually, a cast to int is inserted during semantic on the ShlExp, but
as this one was created during optimize, it never happened.

https://github.com/D-Programming-Language/dmd/pull/2528

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



--- Comment #6 from github-bugzilla puremagic.com 2013-09-12 04:26:48 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d656898cd69ee242a56bf1d0300a7862338674ea
Fix Issue 10682 - [ICE](cgcod.c line 1561) with ^^ operator

The backend can't handle a shift expression with a ulong rhs, so simulate the
cast that is usually added by semantic.

https://github.com/D-Programming-Language/dmd/commit/6a90c4df6a25640e745a0c4aa95defb5a084f8ce
Merge pull request #2528 from yebblies/issue10682

Fix Issue 10682 - [ICE](cgcod.c line 1561) with ^^ operator

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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