Bug 5369 – Segfault with pure auto function in separate module
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2010-12-24T02:01:00Z
Last change time
2012-01-28T15:15:24Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
stanislav.blinov
Comments
Comment #0 by stanislav.blinov — 2010-12-24T02:01:50Z
When a module has a non-templated function that is pure and has auto result type, and at least one parameter, compiler segfaults when compiling another module that imports the first and invokes the function.
Test case:
---
module mod;
// parameter type doesn't matter,
// as long as there is at least one parameter
// and function is not templated
pure auto foo(bool b)
{
return 1;
}
module main;
import mod;
void main()
{
foo(true);
}
---
$ dmd -v test.d mod.d
binary dmd
version v2.051
config /home/user/dmd.conf
parse test
parse mod
importall test
import object (/home/user/dmd2/src/druntime/import/object.di)
importall mod
semantic test
semantic mod
semantic2 test
semantic2 mod
semantic3 test
Segmentation fault
Removing pure or parameters or replacing auto with concrete type, or making function templated, resolves segfault. If the function is defined and used in the same module that is being compiled, segfault doesn't occur either.
Comment #1 by stanislav.blinov — 2010-12-24T02:04:53Z
Sorry, test.d should be main.d
Comment #2 by braddr — 2011-02-06T15:39:11Z
Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.
Comment #3 by clugdbug — 2011-02-10T12:41:17Z
Not confirmed -- cannot reproduce on Windows. Maybe Linux-specific?
On Windows, I just get:
test.d(9): Error: forward reference to foo
But no segfault.
Comment #4 by bugzilla — 2012-01-28T15:15:24Z
Cannot reproduce. Works on Windows, Linux and OS X.