Jump to page: 1 2
Thread overview
[Issue 1516] New: code gen bug with reclusive call
Sep 19, 2007
d-bugmail
Sep 19, 2007
d-bugmail
Sep 19, 2007
d-bugmail
Sep 19, 2007
Bill Baxter
Sep 19, 2007
kris
Sep 19, 2007
BCS
Sep 19, 2007
kris
[Issue 1516] Code generation bug with recursive call
Sep 19, 2007
d-bugmail
Sep 19, 2007
d-bugmail
Sep 19, 2007
d-bugmail
Sep 20, 2007
BCS
September 19, 2007
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.


-- 

September 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1516





------- Comment #1 from davidl@126.com  2007-09-18 23:21 -------
umm, where's the "attached code" ^^ , hehe


-- 

September 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1516





------- Comment #2 from shro8822@vandals.uidaho.edu  2007-09-18 23:26 -------
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.


-- 

September 19, 2007
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
September 19, 2007
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
September 19, 2007
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
> 


September 19, 2007
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
September 19, 2007
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




------- Comment #4 from matti.niemenmaa+dbugzilla@iki.fi  2007-09-19 09:32 -------
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.


-- 

September 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1516


shro8822@vandals.uidaho.edu changed:

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




------- Comment #5 from shro8822@vandals.uidaho.edu  2007-09-19 10:08 -------
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".


-- 

September 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1516


matti.niemenmaa+dbugzilla@iki.fi changed:

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




------- Comment #6 from matti.niemenmaa+dbugzilla@iki.fi  2007-09-19 10:15 -------
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.


-- 

« First   ‹ Prev
1 2