Bug 8842 – Error line numbers for some run-time functions in debug mode?
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-17T15:35:01Z
Last change time
2018-11-24T08:42:46Z
Assigned to
No Owner
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2012-10-17T15:35:01Z
void main() {
int[] foo;
auto bar = new int[10];
foo[] = bar[];
}
Currently that code gives a runtime error with no line number, dmd 2.061alpha:
object.Error: lengths don't match for array copy
The stack trace helps find the location of such error, but maybe in debug mode (-debug) it's worth using a different _d_arraycopy run-time function that accepts line numbers too (named _d_arraycopy_line or something), so it's able to generate a more specific error message.
This line number inflates the binary, but in debug mode what's important is to locate the errors very well.
Comment #1 by stanislav.blinov — 2018-11-24T08:42:46Z
It looks like it was a long journey for the compiler, but since 2.075 the line number is being printed (for -g builds), and is even printed correctly since 2.078.