www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1516] New: code gen bug with reclusive call

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516

           Summary: code gen bug with reclusive call
           Product: D
           Version: 1.018
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: shro8822 vandals.uidaho.edu


the attached code compile and seg-vs the first time the function goes
recursive. removing the notes lines from before the call fixes this. Also using
"-O" fixes it.

I suspect a issue with register selection because at the ASM level the
differences seems to only be the choice of register.

confirmed on Linux

BTW, the when the code works it runs into a stack overflow because I skipped
the terminal case in the function. That is Not the seg-v that is at issue.


-- 
Sep 18 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516






umm, where's the "attached code" ^^ , hehe


-- 
Sep 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516






Created an attachment (id=184)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=184&action=view)
the file

a test case

sorry I took so long. My browser took so long getting back to me I forgot to
finish the post.


-- 
Sep 18 2007
prev sibling next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=1516
 
            Summary: code gen bug with reclusive call
I don't think this word means what you think it means. :-) --bb
Sep 18 2007
parent reply kris <foo bar.com> writes:
Bill Baxter wrote:
 d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=1516

            Summary: code gen bug with reclusive call
I don't think this word means what you think it means. :-) --bb
Yeah, I wondered about that too: has visions of cockroaches heading up the hill to pay the hermits a visit :p
Sep 18 2007
parent reply BCS <ao pathlink.com> writes:
Reply to kris,

 Bill Baxter wrote:
 
 d-bugmail puremagic.com wrote:
 
 http://d.puremagic.com/issues/show_bug.cgi?id=1516
 
 Summary: code gen bug with reclusive call
 
I don't think this word means what you think it means. :-) --bb
Yeah, I wondered about that too: has visions of cockroaches heading up the hill to pay the hermits a visit
wouldn't it be the recluse making the call on the cockroaches?
 :p
 
Sep 18 2007
parent kris <foo bar.com> writes:
BCS wrote:
 Reply to kris,
 
 Bill Baxter wrote:

 d-bugmail puremagic.com wrote:

 http://d.puremagic.com/issues/show_bug.cgi?id=1516

 Summary: code gen bug with reclusive call
I don't think this word means what you think it means. :-) --bb
Yeah, I wondered about that too: has visions of cockroaches heading up the hill to pay the hermits a visit
wouldn't it be the recluse making the call on the cockroaches?
 :p
neh, that would be a reverse-polish reclusive call O_o
Sep 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516


matti.niemenmaa+dbugzilla iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         OS/Version|Linux                       |All
           Platform|PC                          |All
         Resolution|                            |INVALID
            Summary|code gen bug with reclusive |Code generation bug with
                   |call                        |recursive call





-------
Marking as invalid: you're using "r.users.length" when r is null. Change the
condition within Part to "if (r && r.users.length == 0)" and it works.


-- 
Sep 19 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516


shro8822 vandals.uidaho.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |





Also this is a bug despite that because "-O" changes the behavior of the code.

OTOH if what you are pointing to IS the issue, then there is another bug in
that the first scope(failure) is ignored. In fact with a bit of checking, by
dropping the nulls from the recursion, it seems that is the case. Alternately,
it might still be a code gen issue, just fixed by another minor tweak. I'd have
to look at the asm later.

So, however you look at it, there is still a bug, just possibly not the but I
originally saw.

I'm reopening because it /might/ be a code gen bug. If someone can confirm it
is not, Go ahead an close it again and I'll post another bug with regards to
the "scope(failure) issue".


-- 
Sep 19 2007
prev sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1516


matti.niemenmaa+dbugzilla iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID





-------
Woops, didn't notice the bit about -O. I would guess that -O realizes that the
foreach loop does absolutely nothing and thus optimizes it away, but I can't be
sure without checking the asm.

Even if it's not that, it's a different issue, since the code here is correctly
failing on a null pointer dereference. If you can reproduce the behaviour of -O
with a loop which actually does something and shouldn't be optimized away, file
another issue for that. Keeping this as INVALID.


-- 
Sep 19 2007
parent BCS <ao pathlink.com> writes:
Reply to d-bugmail puremagic.com,

 Even if it's not that, it's a different issue, since the code here is
 correctly failing on a null pointer dereference.
I'm not shure that is where the seg-v is. But I'm to lazy to check right now.
Sep 19 2007