www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9271] New: Forwarding lambda predicate with type inference causes segfault

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

           Summary: Forwarding lambda predicate with type inference causes
                    segfault
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com


--- Comment #0 from Jacob Carlborg <doob me.com> 2013-01-05 03:43:55 PST ---
The following code results in a segmentation fault. It seems that "any" is
called indefinitely. If I don't use type inference for the lambda everything
works as it should.

import algorithm = std.algorithm;

bool any (alias predicate, Range) (Range range)
{
    return algorithm.any!(predicate)(range);
}

void main ()
{
    auto arr = ["foo"];
    any!(e => e == "asd")(arr); // segfault 
    // any!((string e) => e == "asd")(arr); // works 
}

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


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru


--- Comment #1 from Maxim Fomin <maxim maxim-fomin.ru> 2013-01-05 06:44:34 PST
---
This works on linux with git head.

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


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|All                         |Windows


--- Comment #2 from Maxim Fomin <maxim maxim-fomin.ru> 2013-01-05 07:02:49 PST
---
However it segfaults on windows using 2.061.

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


Jacob Carlborg <doob me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All


--- Comment #3 from Jacob Carlborg <doob me.com> 2013-01-05 07:03:46 PST ---
Does not work on Mac OS X 32bit. DMD hash
d6f0ef93dbd4d88be7a69f85303f6230a02d58a9

This is the stack trace from GDB:

(gdb) r
Starting program: /Users/doob/development/d/dlang/dmd/src/main 
Reading symbols for shared libraries +......................... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0xbf7ffff4
0x0000181d in D4main4mainFZv30__T3anyS14main9__lambda2TAAyaZ3anyMFAAyaZb ()
(gdb) bt
#0  0x0000181d in D4main4mainFZv30__T3anyS14main9__lambda2TAAyaZ3anyMFAAyaZb ()
#1  0x00001828 in D4main4mainFZv30__T3anyS14main9__lambda2TAAyaZ3anyMFAAyaZb ()
#2  0x00001828 in D4main4mainFZv30__T3anyS14main9__lambda2TAAyaZ3anyMFAAyaZb ()
#3  0x00001828 in D4main4mainFZv30__T3anyS14main9__lambda2TAAyaZ3anyMFAAyaZb ()

Repeated like the above.

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