www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8624] New: CTFE: 0x6161636772 == 0x4161636772

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

           Summary: CTFE: 0x6161636772 == 0x4161636772
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ellery-newcomer utulsa.edu



19:17:47 PDT ---
dmd 2.060 x64 linux.

code:

int generateHashAndValueArrays()
{
  import std.string;
  assert(H("a") != H("A"), xformat("%x == %x",  H("a"), H("A")));
  return 1;
}

enum s = (generateHashAndValueArrays());

ulong H(string str)
{
    if(str[0] == 'a') return 0x6161636772;
    return 0x4161636772;
}


fireworks:

HtmlEntities.d(4): Error: ['6','1','6','1','6','3','6','7','7','2','
','=','=',' ','4','1','6','1','6','3','6','7','7','2'][0LU..24LU]

ehh,

HtmlEntities.d(4): Error: "6161636772 == 4161636772"

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, wrong-code
                 CC|                            |clugdbug yahoo.com.au
            Summary|CTFE: 0x6161636772 ==       |Regression: CTFE: long
                   |0x4161636772                |comparisons completely
                   |                            |broken
           Severity|normal                      |regression



This is one of the worst bugs of all time. I can't believe this slipped through
the test suite. The top 32 bits of longs is entirely ignored in CTFE == and !=
comparisons. Reduced test case:
====================
int bug8624()
{
  long  m =  0x1_0000_0000;
  assert(m != 0);
  return 1;
}
static assert(  bug8624() );
====================
It's a typo in interpret.c, which results in an implicit conversion from long
to int.
This might be worth an emergency release.

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


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr puremagic.com



---
In which version did it last work correctly?

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



13:14:27 PDT ---

 It's a typo in interpret.c, which results in an implicit conversion from long
 to int.
 This might be worth an emergency release.
Please post pull request, and I'll get it pulled at least. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 08 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8624




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9a732a03c9f671a7c45a9f7dbe485a0b3489f997
Fix issue 8624 Regression: CTFE: long comparisons completely broken

An implicit narrowing cast from long to int. Catastrophic.

https://github.com/D-Programming-Language/dmd/commit/475178efa63597d6d55a074406678ab92f1075ed


Fix issue 8624 Regression: CTFE: long comparisons completely broken

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


Walter Bright <bugzilla digitalmars.com> changed:

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


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