Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
August 12, 2006 [Issue 285] New: Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=285 Summary: Struct method null pointer assert has line number of "0" Product: D Version: 0.163 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: jarrett.billingsley@gmail.com struct S { void fork() { } } void main() { S* s = null; s.fork(); } This causes an AssertError with the correct module name, but with a line number of 0, which is really, really unhelpful. I didn't know DMD even inserted this null check, I think it's pretty cool :) Would be nice if it included the message "struct 'this' pointer is null" or "struct method called through null pointer" or something along those lines. -- |
August 12, 2006 Re: [Issue 285] New: Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=285
>
> Summary: Struct method null pointer assert has line number of "0"
> Product: D
> Version: 0.163
> Platform: PC
> OS/Version: Windows
> Status: NEW
> Severity: normal
> Priority: P2
> Component: DMD
> AssignedTo: bugzilla@digitalmars.com
> ReportedBy: jarrett.billingsley@gmail.com
>
>
> struct S
> {
> void fork()
> {
>
> }
> }
>
> void main()
> {
> S* s = null;
> s.fork();
> }
>
> This causes an AssertError with the correct module name, but with a line number
> of 0, which is really, really unhelpful.
>
> I didn't know DMD even inserted this null check, I think it's pretty cool :) Would be nice if it included the message "struct 'this' pointer is null" or
> "struct method called through null pointer" or something along those lines.
>
>
Cute and all; but I sure hope such codegen is disabled via a switch such as -release ...
|
August 13, 2006 Re: [Issue 285] New: Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
Posted in reply to kris | "kris" <foo@bar.com> wrote in message news:ebln9m$24kh$1@digitaldaemon.com... > Cute and all; but I sure hope such codegen is disabled via a switch such as -release ... Indeed it is, just like array bounds checking and the like. In fact, all it does is insert an implicit "assert(this !is null)", and since it's like any other assert, it compiles out in release mode. |
August 14, 2006 Re: [Issue 285] New: Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-08-12: > http://d.puremagic.com/issues/show_bug.cgi?id=285 > struct S > { > void fork() > { > > } > } > > void main() > { > S* s = null; > s.fork(); > } > > This causes an AssertError with the correct module name, but with a line number of 0, which is really, really unhelpful. Added to DStress as http://dstress.kuehne.cn/norun/s/struct_26_A.d Thomas |
September 09, 2006 [Issue 285] Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=285 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Keywords| |diagnostic ------- Comment #2 from smjg@iname.com 2006-09-09 18:27 ------- It's been suggested before that we should have some kind of error that unambiguously indicates an attempt to dereference a null pointer. This was mainly in reference to class object references, but I suppose it would apply to structs just as well. -- |
September 19, 2006 [Issue 285] Struct method null pointer assert has line number of "0" | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=285 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #3 from bugzilla@digitalmars.com 2006-09-19 15:24 ------- Fixed in DMC 0.167. -- |
Copyright © 1999-2021 by the D Language Foundation