Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
May 17, 2009 [Issue 2998] New: ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2998 Summary: ICE(expression.c) with floating point enum Product: D Version: 2.030 Platform: PC OS/Version: Windows Status: NEW Keywords: ice-on-valid-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: rsinfu@gmail.com -------------------- enum E : real { a, b } -------------------- assert expression.c(1392) 0 -------------------- This error does not occur when all members are explicitly initialized, or there is only one member in the enum. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 02, 2009 [Issue 2998] ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsinfu@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=2998 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-09-02 00:32:14 PDT --- PATCH: enum.c, in EnumDeclaration::semantic(), around line 195. The interpret optimisation should be done BEFORE the cast. Just swap the order. Otherwise, constfold functions such as Add() think it's an enum type, not a real, and so they default to integer, and chaos ensues. // Now set e to (elast + 1) e = new AddExp(em->loc, elast, new IntegerExp(em->loc, 1, Type::tint32)); e = e->semantic(sce); + e = e->optimize(WANTvalue | WANTinterpret); e = e->castTo(sce, elast->type); - e = e->optimize(WANTvalue | WANTinterpret); ---- However, there are other problems in this function. If you try to use a struct inside an enum, you get garbage error messages without line number; you find that you need to define a .max() property for the struct, and error messages are repeated. I attach a revised enum.c which fixes these problems, and allows the code below to work correctly: enum G : real { a, b } enum E : real { a=18.0, b } enum F : real { c=E.b, d } struct S{ int x; S opAdd(int q) { return S(x+1);} int opCmp(S s) { return x < s.x; } } enum H : S { a=S(0), b} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 02, 2009 [Issue 2998] ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsinfu@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=2998 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-02 00:33:56 PDT --- Created an attachment (id=443) --> (http://d.puremagic.com/issues/attachment.cgi?id=443) enum.c for DMD2.032 Fixes many of the problems with enums. Tested with the pre-release DMD2.032 beta. D2 only. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 03, 2009 [Issue 2998] ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsinfu@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=2998 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #443 is|0 |1 obsolete| | --- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-09-03 00:05:58 PDT --- Created an attachment (id=444) --> (http://d.puremagic.com/issues/attachment.cgi?id=444) enum.c for DMD2.032 Revised enum.c. The version I posted was incorrect, and failed one of the test suite tests. This version passes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 01, 2009 [Issue 2998] ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsinfu@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=2998 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-10-01 10:42:10 PDT --- The order in which those two functions are called shouldn't matter. The actual problem is the TypeEnum doesn't have proper overrides for isreal, isimaginary, etc. Will fix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 06, 2009 [Issue 2998] ICE(expression.c) with floating point enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsinfu@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=2998 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2009-10-06 02:20:50 PDT --- Fixed dmd 2.033 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation