www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 235] New: goto & scope: cannot goto forward into different try block level

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

           Summary: goto & scope: cannot goto forward into different try
                    block level
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: thomas-dloop kuehne.cn


According to DMD-0.162's documentation the code below is valid but is rejected
by DMD: cannot goto forward into different try block level

void foo(bool b){
        if(b){
                goto label;
        }

        status = 2;
        scope(exit){
                status--;
        }

label:
        {
        }
}


-- 
Jul 02 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://www.digitalmars.com/d
                   |                            |rn-
                   |                            |bin/wwwnews?digitalmars.D.bu
                   |                            |gs/7742




------- Comment #1 from thomas-dloop kuehne.cn  2006-07-02 10:53 -------
test cases:
http://dstress.kuehne.cn/run/s/scope_14_A.d
http://dstress.kuehne.cn/run/s/scope_14_B.d


-- 
Jul 02 2006
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


daekharel gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daekharel gmail.com
           Severity|normal                      |critical




------- Comment #2 from daekharel gmail.com  2006-11-20 16:51 -------
I've verified this bug on DMD 0.174. In addition, the same problem appears in
the following code:

class Foo {
    invariant {}
    synchronized void foo() { return; }
}

After fiddling around to see when an error occurs, it seems the problem arises
in the presence of the combination of both an invariant and a synchronized
method with a return statement (even if the invariant and return statement do
nothing, as in the example above). However, I've managed to get code which has
this combination to compile on Windows under DMD 0.174, but the same code would
not compile on Linux, as it caused this error, so it may be a linux-only
problem.

Since having invariants and synchronized methods in the same class is far from
an uncommon use-case, I'm raising the severity of this bug to critical.


-- 
Nov 20 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-11-20:
 http://d.puremagic.com/issues/show_bug.cgi?id=235

 ------- Comment #2 from daekharel gmail.com  2006-11-20 16:51 -------
 I've verified this bug on DMD 0.174. In addition, the same problem appears in
 the following code:

 class Foo {
     invariant {}
     synchronized void foo() { return; }
 }

 After fiddling around to see when an error occurs, it seems the problem arises
 in the presence of the combination of both an invariant and a synchronized
 method with a return statement (even if the invariant and return statement do
 nothing, as in the example above). However, I've managed to get code which has
 this combination to compile on Windows under DMD 0.174, but the same code would
 not compile on Linux, as it caused this error, so it may be a linux-only
 problem.

 Since having invariants and synchronized methods in the same class is far from
 an uncommon use-case, I'm raising the severity of this bug to critical.

Added to DStress as http://dstress.kuehne.cn/run/s/scope_14_C.d http://dstress.kuehne.cn/run/s/scope_14_D.d http://dstress.kuehne.cn/run/s/scope_14_E.d http://dstress.kuehne.cn/run/s/scope_14_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFZEoJLK5blCcjpWoRApdcAJ9c365wajdUZGYLJQkDdIksT8GIJgCfQSMo qKv6uGZ8JfQx5DCCd8V7mrw= =Qqur -----END PGP SIGNATURE-----
Nov 22 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235





------- Comment #3 from daekharel gmail.com  2006-11-20 17:33 -------
The same error appears when using "out" contracts on synchronized methods with
return statements in them, for example:

class Foo {    
    synchronized void foo()
    out {} body { return; }
}


-- 
Nov 20 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235





------- Comment #5 from torhu yahoo.com  2008-01-24 16:34 -------
I don't know if it matters, but when compiling with -o-, I don't get this error
message.  I tried the DStress 14_C test case with 1.023 on linux.

I had to prefix a class invariant with 'version (Windows)' to fix this in some
code of my own.


-- 
Jan 24 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


Mario Kroeplin <nilpeork googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nilpeork googlemail.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com




--- Comment #6 from Mario Kroeplin <nilpeork googlemail.com>  2009-07-18
06:10:06 PDT ---
Some contracts on 'synchronized' functions are still rejected by the compilers
D_1.046 and D_2.031 without indicating line numbers or providing intelligible
information.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 18 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr puremagic.com




--- Comment #7 from Brad Roberts <braddr puremagic.com>  2009-07-18 10:32:20
PDT ---
Mario, are you reporting that this bug isn't fixed, or that you have other test
cases that include additional issues?  If you have additional test cases that
produce different issues please file a new bug and include complete examples
including both the code to reproduce it and the output from the compiler that
shows exactly what you're showing to be done wrong.  Vague reports like your
reply here aren't particularly actionable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 18 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


puremagic.com bregalad.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |puremagic.com bregalad.de


--- Comment #8 from puremagic.com bregalad.de 2009-09-16 01:37:26 PDT ---
Concerning Michael Arntzenius comment: After running into this problem in linux
(DMD 1.043), I can confirm that exactly his example compiles on _neither_ linux
(DMD 1.043) or OSX (DMD 1.046)...  so it's apparently not quite linux-only
(although I suppose the linux and OSX source code is substantially the
same...).

"Error: cannot goto forward into different try block level".

In both cases, -o- makes the error message go away as suggested by
torhu yahoo.com, but this doesn't seem like a terribly useful observation (at
least not from the perspective of a user ,-))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #9 from Don <clugdbug yahoo.com.au> 2010-11-24 19:40:57 PST ---
Starting with 1.064, the error message has changed to "cannot goto into try
block". The code compiles on 2.010 and later.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
           Severity|critical                    |normal


--- Comment #10 from Andrei Alexandrescu <andrei metalanguage.com> 2010-11-26
10:35:59 PST ---
Downgrading severity as there are plenty of workarounds.

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