Jump to page: 1 24  
Page
Thread overview
[Issue 4269] New: invalid type accepted if evaluated while errors are gagged
Jun 04, 2010
Rainer Schuetze
[Issue 4269] Regression(2.031): invalid type accepted if evaluated while errors are gagged
Jun 15, 2010
Don
Jun 15, 2010
Don
Aug 25, 2010
Don
Feb 11, 2011
Don
Jul 10, 2011
yebblies
Aug 30, 2011
Don
Aug 30, 2011
yebblies
Sep 05, 2011
klickverbot
Sep 21, 2011
Walter Bright
Sep 21, 2011
yebblies
Feb 07, 2012
Walter Bright
Feb 07, 2012
yebblies
Feb 07, 2012
Walter Bright
Feb 07, 2012
Walter Bright
Feb 07, 2012
Don
Feb 09, 2012
Don
Feb 09, 2012
yebblies
Feb 10, 2012
yebblies
Feb 10, 2012
yebblies
Feb 10, 2012
yebblies
Feb 10, 2012
Don
Feb 22, 2012
Walter Bright
May 03, 2012
Don
Dec 13, 2012
Don
Jan 16, 2013
Don
June 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4269

           Summary: invalid type accepted if evaluated while errors are
                    gagged
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: r.sagitario@gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario@gmx.de> 2010-06-04 05:58:53 PDT ---
The D2 code (tried with DMD 2.042 and 2.046):

static if(__traits(compiles,A.sizeof)) pragma(msg, "A.sizeof compiles!");

class A
{
    void foo(B b);
}


compiles without error with "dmd -c test.d" or even links if foo is made final.

This is caused by the error when evaluating B is muted while processing __traits(compiles), but A is never revisited later.

A debug version of DMD outputs

ty = 37, '_error_'
assert glue.c(1059) 0

This can happen whenever globals.gag is non-zero, i.e. with speculative semantic analysis.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au
            Version|unspecified                 |D2
            Summary|invalid type accepted if    |Regression(2.031): invalid
                   |evaluated while errors are  |type accepted if evaluated
                   |gagged                      |while errors are gagged
           Severity|normal                      |regression


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-06-15 07:25:53 PDT ---
Generated an error message in 2.030 and earlier.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
            Version|D2                          |D1 & D2


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-06-15 13:41:05 PDT ---
Here's a test case which incorrectly compiles on D1.055 and later, but generated an error on DMD1.053 and earlier.

static if(!is(typeof(A[0]))) pragma(msg, "A.sizeof doesn't compile!");

struct A {
    B foo(){}
}

And this variation is ICE(glue.c) on 2.047, but generates wrong code on
2.031-2.046.

static if(!is(typeof(A[0]))) pragma(msg, "A.sizeof doesn't compile!");
struct A {
    void foo(B b){}
}

-- 
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=4269



--- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-08-25 12:44:15 PDT ---
This test case it's a problem with is(), not static if. This behaviour was
introduced in 2.047.
--------
enum bool WWW = is(typeof(A.x));

class A {
    B blah;
    void foo(B b){}
}
--------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 11, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4269


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandford@jhu.edu


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-02-11 05:23:49 PST ---
*** Issue 5079 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: -------
July 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4269


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #5 from yebblies <yebblies@gmail.com> 2011-07-11 00:33:53 EST ---
The problem seems to be a huge forward reference bug.  When semantic is first called on a declaration while errors are gagged, it is never attempted again. This leads to errors never being printed, and compilation happily continuing to code generation.

The solution is probably the same as for bug 4042 - add the ability to rewind the semantic pass on failure to each type of declaration's semantic routines.

Some fun test cases:

// Compiles without error
//static if(is(typeof(X1.init))) {}
//class X1 { Y y; }

// Compiles without error
//static if(is(typeof(X2.init))) {}
//struct X2 { Y y; }

// Assertion failure: '0' on line 1123 in file 'glue.c'
//static if(is(typeof(X3.init))) {}
//void X3(T) { }

// Compiles without error
//static if(is(typeof(X4.init))) {}
//Y X4() { return typeof(return).init; }

// Access violation in mtype.c:6819
//static if(is(typeof(X5.init))) {}
//typedef Y X5;

// Compiles without error
//static if(is(typeof(X6.init))) {}
//alias Y X6;

// Assertion failure: '0' on line 1123 in file 'glue.c'
//static if(is(typeof(X7))) {}
//Y X7;

// Compiles without error
//static if(is(typeof(X8.init))) {}
//class X8 : Y {}

// Compiles without error
//static if(is(typeof(X9.init))) {}
//interface X9 : Y {}

// Compiles without error
//static if(is(typeof(X9.init))) {}
//interface X9 { Y y; }

// Doesn't even need the errors gagged - what the hell?
// Probably a different bug
//struct X10 { alias Y this; }

// Assertion failure: '0' on line 1123 in file 'glue.c'
//static if(is(typeof(X11.init))) {}
//const { Y X11; }

// Compiles without error
//static if(is(typeof(X12.init))) {}
//enum X12 = Y;

// Compiles without error
//static if(is(typeof(X13!(0).init))) {}
//template X13(Y y) {}

// Compiles without error
//static if(is(typeof(X14.init))) {}
//struct X14 { int a; alias a this; alias a this; }

// Compiles without error
//static if(is(typeof(X15()))) {}
//auto X15() { alias x this; }

// Compiles without error
//static if(is(typeof(X16))) {}
//alias X16 X16;

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



--- Comment #6 from Don <clugdbug@yahoo.com.au> 2011-08-30 01:42:25 PDT ---
I think there are a couple of different issues here. Some involve forward
referenced declarations, as you've said.
But some of these occur because they have semantic run while errors are
_incorrectly_ gagged. In particular, when semantic3 is run on a function,
errors shouldn't be gagged unless the function is part of a template which was
speculatively instantiated. I'm halfway through a patch for this.

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



--- Comment #7 from yebblies <yebblies@gmail.com> 2011-08-31 00:58:01 EST ---
(In reply to comment #6)
> I think there are a couple of different issues here. Some involve forward
> referenced declarations, as you've said.
> But some of these occur because they have semantic run while errors are
> _incorrectly_ gagged. In particular, when semantic3 is run on a function,
> errors shouldn't be gagged unless the function is part of a template which was
> speculatively instantiated. I'm halfway through a patch for this.

Does your gagging solution fix the problem for all semantic passes, or just semantic3?  I couldn't think of a way to do it without rewinding semantic on error, that gets error messages appearing in the right places.  Since you've got it under control, I'll work on something else.

Should I close the pull request, does your patch cover that?

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


klickverbot <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@klickverbot.at


--- Comment #8 from klickverbot <code@klickverbot.at> 2011-09-04 22:51:20 PDT ---
Related, but not the same: bug 6602.

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #9 from Walter Bright <bugzilla@digitalmars.com> 2011-09-20 18:51:40 PDT ---
4269 - Regression(2.031): invalid type accepted if evaluated while errors are
gagged

https://github.com/D-Programming-Language/dmd/commit/106a4c530f1b55c5e7a7f20c841c73fc882c9a6e

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