digitalmars.D.bugs - [Issue 3775] New: Compiler segfaults on cast(string) stdin.byLine.
- d-bugmail puremagic.com (32/32) Feb 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
- d-bugmail puremagic.com (19/19) Feb 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
- d-bugmail puremagic.com (33/33) Feb 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
- d-bugmail puremagic.com (10/10) Feb 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
- d-bugmail puremagic.com (12/13) Feb 12 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
- d-bugmail puremagic.com (11/11) Mar 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3775
http://d.puremagic.com/issues/show_bug.cgi?id=3775 Summary: Compiler segfaults on cast(string) stdin.byLine. Product: D Version: 2.040 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: blood.of.life gmail.com 18:36:45 PST --- Apologies if this is a duplicate, I couldn't see anything *obvious*. I'm sure this is invalid code, but I got on to doing this (don't ask): --- module segfault; import std.stdio; void main() { foreach (line; cast(string) stdin.byLine) {} } --- Which leads to: --- $ dmd segfault Segmentation fault --- Needless to say, no object or executable file is produced. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3775 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|2.040 |1.00 Summary|Segfault(cast.c): on |Segfault(cast.c): casting |cast(string) stdin.byLine. |no-parameter template | |function using property | |syntax Reduced test case also segfaults on D1, even ancient ones like DMD0.175. struct Bug3775 { static int byLine()() { return 1; } } static assert( cast(int) Bug3775.byLine); Somehow, in DotIdExp::semantic, it has no type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3775 ROOT CAUSE: This is an interaction between IFTI and property syntax. PATCH: At the end of CastExp::semantic, make sure that the function has a type. Index: expression.c =================================================================== --- expression.c (revision 373) +++ expression.c (working copy) -7796,7 +7796,11 // BUG: Check for casting array types, such as void[] to int*[] } - + if (!e1->type && e1->op==TOKdottd) + { + error("%s is a template and cannot be called with property syntax", e1->toChars()); + return new ErrorExp(); + } e = e1->castTo(sc, to); return e; } ===== Some similar cases cause the compiler to do strange things (see below), so I'm not completely satisfied with the patch. But let's just fix the segfault. struct Bug3775 { static int byLine()() { return 1; } } void main(){ auto xxx = Bug3775.byLine; } // accepted; xxx is an int. void main(){ int xxx = Bug3775.byLine; } // rejected: (Bug3775).byLine() has no value -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3775 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 22:55:17 PST --- changeset 378 and 379 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3775 Kosmonaut <Kosmonaut tempinbox.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Kosmonaut tempinbox.com ---changeset 378 and 379http://www.dsource.org/projects/dmd/changeset/378 http://www.dsource.org/projects/dmd/changeset/379 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 12 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3775 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED 22:23:27 PST --- Fixed dmd 1.057 and 2.041 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2010