[Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2014-04-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3192

Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

Version|1.046   |D1

--


[Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2009-07-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3192


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au
Summary|asm in a anonymous delegate |Segfault(iasm.c) asm in a
   |crash the compiler  |anonymous delegate
   Severity|blocker |major




--- Comment #1 from Don clugd...@yahoo.com.au  2009-07-20 00:26:41 PDT ---
Reduced test case:

void delegate () foo = (){ asm{ int 3; }};

This is segfaulting in iasm.c (line 4269 in DMD2).
if( sc-func-type-nextOf()-isScalar()) // segfaults here: nextOf() is null.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2009-07-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3192


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch




--- Comment #2 from Don clugd...@yahoo.com.au  2009-07-20 00:50:55 PDT ---
This patch is enough to fix the segfault, and allow the code to compile. I'm
not sure if it's correct that nextOf() is null, though -- there may be a deeper
problem here.

iasm.c line 4269. (in Statement *AsmStatement::semantic(Scope *sc)):

asmstate.bReturnax = 1;
-if (sc-func-type-nextOf()-isscalar())
+if (sc-func-type-nextOf()  sc-func-type-nextOf()-isscalar())
asmstate.bReturnax = 0;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2009-07-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3192


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com




--- Comment #3 from Walter Bright bugzi...@digitalmars.com  2009-07-20 
02:24:23 PDT ---
For inferring function return type, the nextOf() is null. That would be a
problem here, but we never use bReturnax anyway, so just #if out the code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2009-07-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3192





--- Comment #4 from Don clugd...@yahoo.com.au  2009-07-20 02:38:02 PDT ---
(In reply to comment #3)
 For inferring function return type, the nextOf() is null.

It'd be great if you could put that in a comment in the definition of nextOf().
I'd never been sure when it's supposed to be non-null, it's one of the least
obvious things in the code. Should it become non-null in a later semantic pass?

Also a comment about the cto, ito, sto members of type would be really useful.
When should they be non-null?
In a great many of the compiler bugs I've looked at, they're null, but I've not
been sure whether the bug is that they're null, or that other code is not
dealing with the case that they're null.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


Re: [Issue 3192] Segfault(iasm.c) asm in a anonymous delegate

2009-07-20 Thread Walter Bright

I'll put some comments in.