digitalmars.D.bugs - [Issue 3737] New: SEG-V at expression.c:6255 from bad code
- d-bugmail puremagic.com (25/25) Jan 23 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (6/6) Jan 23 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (22/22) Jan 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (7/7) Jan 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (7/9) Jan 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (20/20) Jan 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (45/45) Jan 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (10/10) Feb 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (11/12) Feb 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
- d-bugmail puremagic.com (11/11) Mar 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3737
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Summary: SEG-V at expression.c:6255 from bad code
Product: D
Version: 2.039
Platform: Other
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: shro8822 vandals.uidaho.edu
---
Created an attachment (id=554)
patch to convert seg-v to assert
I'm getting a seg-v (not an assert) at expression.c:6255 from some bad template
code.
this is the test case:
http://www.dsource.org/projects/scrapple/browser/trunk/units/si2.d?rev=689
compile with "-unittest -version=BUG" to get error
compile with "-unittest" to get correct result.
attached is a patch that converts the seg-v to an assert.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737 --- I forgot to mention; I tried to cut down the test case and it quit erroring. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 23 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
CC| |clugdbug yahoo.com.au
I can't reproduce the segfault. When compiling si2, I just get this:
------
si2.d(155): Error: Cannot interpret
SIB!(__T5BatchVi1Vi1Vi0Vi1Vi0Vi1Vi0Vi1Vi0Vi1
Z,real) at compile time
si2.d(155): Error: Cannot interpret
SIB!(__T5BatchVi1Vi1Vi0Vi1Vi0Vi1Vi0Vi1Vi0Vi1
Z,real) at compile time
si2.d(155): Error: template instance
'Batch!(LengthN,1,MassN,1,TimeN,1,TempN,1,C
urrentN,1)' is not a variable
si2.d(155): Error: no property 'LenD' for type 'int'
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737 --- What version of DMD? I got it with 2.039 on both windows and linux. Might it already be fixed in SVN? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737What version of DMD? I got it with 2.039 on both windows and linux. Might it already be fixed in SVN?I can reproduce it now. I think I had the wrong rational.d. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Reduced test case. Something to do with opDispatch.
======================
int crayon;
struct SIB(alias junk)
{
template Alike(V) {
enum bool Alike = Q == V.garbage;
}
void opDispatch(string s)() {
static assert(Alike!(SIB!(crayon)));
}
}
void main() {
SIB!(SIB!(crayon).E)(3.0);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Summary|SEG-V at expression.c:6255 |SEG-V at expression.c:6255
|from bad code |from bad opDispatch
Cause: If global.errors && !global.gag, TemplateInstance::semantic doesn't set
'inst'. So this is a possible patch (not recommended) inside template.c:
{
if (!global.gag)
{
/* Trying to soldier on rarely generates useful messages
* at this point.
*/
fatal();
}
+ inst = this; // error recovery
return;
}
===
But, on the other hand, most other functions in expression.c only run
ti->semantic() if there are global.errors.
So this patch to expression.c line 6252 may be better:
Expression *DotTemplateInstanceExp::semantic(Scope *sc)
{
#if LOGSEMANTIC
printf("DotTemplateInstanceExp::semantic('%s')\n", toChars());
#endif
Expression *eleft;
Expression *e = new DotIdExp(loc, e1, ti->name);
L1:
e = e->semantic(sc);
if (e->op == TOKdottd)
{
+ if (global.errors) return new ErrorExp();
DotTemplateExp *dte = (DotTemplateExp *)e;
TemplateDeclaration *td = dte->td;
The same problem occurs in mtype.c, line 6613, 7101, inside ::dotExp(), for
structs and classes, and they should probably have the same fix.
(they shouldn't be running ti->semantic() if there are global errors).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla digitalmars.com
21:10:21 PST ---
changeset 367
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Kosmonaut <Kosmonaut tempinbox.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Kosmonaut tempinbox.com
---
changeset 367
http://www.dsource.org/projects/dmd/changeset/367
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3737
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
22:22:36 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









d-bugmail puremagic.com 