[Issue 13382] New: [e2ir] compare string to int - leads to ICE in e2ir.c 1902
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Aug 27 06:38:22 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13382
Issue ID: 13382
Summary: [e2ir] compare string to int - leads to ICE in e2ir.c
1902
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: gassa at mail.ru
Reading a string from standard input and trying to compare it with an integer,
like this:
-----
if ((sn = readln ()) > 0) {}
-----
triggers an error:
-----
Internal error: e2ir.c 1902
-----
A full example follows. It reproduces for me on DMD 2.065.0-2.066.0 on Win32.
With 2.064.2 and earlier, I get a somewhat better "Array operation not
implemented" compiler error. Decomposing the problematic line also gives a
normal "Incompatible types" error.
-----
import std.stdio, std.string;
void main () {
string sn;
if ((sn = readln ()) > 0) {
}
}
-----
The story is that I was first reading an integer, like this:
-----
while (readf (" %s", &n) > 0) {...}
-----
and later changed reading an integer to reading a string, but forgot to fix the
exit condition.
Anyway, an internal compiler error does not specify the line of my source file,
which is inconvenient.
--
More information about the Digitalmars-d-bugs
mailing list