Jump to page: 1 2
Thread overview
[Issue 4543] New: typedef circular definition and ICE
Aug 01, 2010
Iain Buclaw
Aug 01, 2010
Iain Buclaw
Aug 17, 2010
Don
[Issue 4543] Regression(1.054, 2.038) typedef circular definition and segfault
Aug 25, 2010
Don
Aug 25, 2010
Don
Aug 26, 2010
Don
Sep 29, 2010
Don
Mar 01, 2011
Iain Buclaw
Mar 01, 2011
Iain Buclaw
Mar 24, 2011
Iain Buclaw
Mar 24, 2011
Iain Buclaw
Apr 19, 2011
Walter Bright
August 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543

           Summary: typedef circular definition and ICE
           Product: D
           Version: D1
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: ibuclaw@ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw@ubuntu.com> 2010-08-01 04:10:55 PDT ---
In DMD 1.049, this code used to work:

--
bug01a.d
----------
module bug01a;
import bug01b;
union any {}
typedef any ANY;

--
bug01b.d
-----------
module bug01b;
import bug01a;
struct circular_definition {
    union {
        ANY subany;
    }
}

Later (not sure when, but have tested on DMD 1.059) - this code began failing
with the message:

bug01a.d(4): Error: typedef bug01a.ANY circular definition


Now - this code fails and ICE's the compiler:

bug01a.d(4): Error: typedef bug01a.ANY circular definition
Segmentation fault


Other things to note about the bug, swapping the typedef and union declaration in bug01a.d works

--
bug02a.d
----------
module bug02a;
import bug02b;
typedef any ANY;
union any {}


However, adding another struct in the second module triggers it again

--
bug02b.d
----------
module bug02b;
import bug02a;
struct circular_definition {
    union {
        ANY subany;
    }
}
struct triggers_bug {}


And ultimately, putting the import at the bottom means it compiles successfully all the time.

--
works01a.d
----------
module works01a;
typedef any ANY;
union any {}
import works01b;


Regards

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2010-08-01 05:15:08 PDT ---
According to Andrei 'typedef' will be removed from the language. Is an 'alias' there giving the same troubles?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #2 from Iain Buclaw <ibuclaw@ubuntu.com> 2010-08-01 05:33:11 PDT ---
(In reply to comment #1)
> According to Andrei 'typedef' will be removed from the language. Is an 'alias' there giving the same troubles?

That it does not. Also, I thought typedef was being removed only for D2?

This is sad news for me...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #3 from bearophile_hugs@eml.cc 2010-08-01 06:18:10 PDT ---
You are right, typedef will be removed from D1 only.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #4 from bearophile_hugs@eml.cc 2010-08-01 06:19:10 PDT ---
You are right, typedef will be removed from D2 only.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
           Severity|normal                      |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D1                          |D1 & D2
            Summary|typedef circular definition |Regression(1.054, 2.038)
                   |and ICE                     |typedef circular definition
                   |                            |and segfault


--- Comment #5 from Don <clugdbug@yahoo.com.au> 2010-08-24 23:55:47 PDT ---
Both of the unions in the test case can be replaced with structs without
changing the behaviour.
The union inside circular_definition must be anonymous. If it is given a name,
compilation succeeds.
Also, if  union any {} is changed into: alias int any; then it segfaults on
2.038.
So the fact that it started segfaulting on the union case is probably not
important.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #6 from Don <clugdbug@yahoo.com.au> 2010-08-25 12:42:01 PDT ---
Bug 3976 is probably a duplicate of this one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer@utulsa.edu


--- Comment #7 from Don <clugdbug@yahoo.com.au> 2010-08-26 07:40:22 PDT ---
*** Issue 3976 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4543



--- Comment #8 from Don <clugdbug@yahoo.com.au> 2010-09-29 00:27:35 PDT ---
Caused by svn 318, which was fixing bug 282 "Bizarre circular import nested name invisibility issue". Regression bug 3682 was introduced at the same time.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2