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





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





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

 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






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






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





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





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



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



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 next 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



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
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=235


Jesse Phillips <Jesse.K.Phillips+D gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Jesse.K.Phillips+D gmail.co
                   |                            |m
   Target Milestone|---                         |2.059


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2012