[Issue 24460] scope(failure) with a goto breaks safety

2024-07-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 Bolpat changed: What|Removed |Added CC||qs.il.paperi...@gmail.com --- Comment #3 from

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #11 from Dlang Bot --- dlang/dmd pull request #16510 "fix issue24534 : goto can skip declarations in labeled statements without error" was merged into master: - 7f30b66d3dae37544c7629af1178f908984c2a93 by Ben Jones: Fix Bugzilla Issue 24534 : got

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-20 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 --- Comment #10 from Ben --- "Since this is used in C code quite often, and therefore ported code (such as dmd's backend)." >From what I can tell, there's only one place in the whole compiler that's affected by this bug, so I don't think this is

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 --- Comment #9 from Jonathan M Davis --- (In reply to Richard (Rikki) Andrew Cattermole from comment #7) > But, it is also desirable to skip variable declarations, as long as you > don't touch them you do not violate the spec clause. The spec

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-19 Thread d-bugmail--- via Digitalmars-d-bugs
: ``` Label: SomethingWithSideEffects var = 0; try { if (uniform01() > 0.5) return 0; goto Label; } finally var.~this(); ``` This means only forward goto's have broken analysis. --

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 --- Comment #7 from Richard (Rikki) Andrew Cattermole --- It is a bug in the compiler, I agree on that too. But, it is also desirable to skip variable declarations, as long as you don't touch them you do not violate the spec clause. Since this is

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 Jonathan M Davis changed: What|Removed |Added Severity|enhancement |normal --- Comment #6 from Jonathan M

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-17 Thread d-bugmail--- via Digitalmars-d-bugs
--- @benjones updated dlang/dmd pull request #16510 "fix issue24534 : goto can skip declarations in labeled statements without error" fixing this issue: - Fix Bugzilla Issue 24534 : goto can skip declarations in labeled statements without error https://github.com/dlang/dmd/pull/16510 --

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 --- Comment #4 from Ben --- Gotta be a bug: void f2(){ //compiles fine int x2; goto Label2; Dummy2: int y2; Label2: int z2; } GotoStatement::semantic() for Label2 goto lastvar: x2 LabelStatement::semantic() for Dummy2

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 --- Comment #3 from Jonathan M Davis --- Well, it's in clear violation of the spec: https://dlang.org/spec/statement.html#goto-statement So, either the spec is wrong, or dmd is. Also, if you slap @safe on main, it compiles even though

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
error. It is very C style, and is used in dmd. The solution of course would be to create a new scope so it doesn't bleed between the labels. ```d goto Lerror; Lsuccess: { } Lerror: { } ``` If this is fixed, it's going to need a very long deprecation. Or we could kill off this logic entirely

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 Ben changed: What|Removed |Added CC||ben.james.jo...@gmail.com --- Comment #1 from Ben

[Issue 24535] Accepts Invalid: goto can skip declarations if they're labelled

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24535 Ben changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

Re: Goto skipping declarations

2024-05-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
list for the goto from the label. I looked into it fairly recently as an example of type state analysis D is already designed against.

Re: Goto skipping declarations

2024-05-03 Thread Ben Jones via Digitalmars-d-learn
On Friday, 3 May 2024 at 20:38:31 UTC, Jonathan M Davis wrote: https://issues.dlang.org/show_bug.cgi?id=24535

Re: Goto skipping declarations

2024-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 3, 2024 2:38:31 PM MDT Jonathan M Davis via Digitalmars-d-learn wrote: > On Friday, May 3, 2024 1:15:16 PM MDT Ben Jones via Digitalmars-d-learn wrote: > > In general, you can't skip a declaration with goto, but it seems > > to be allowed if the declaration

[Issue 24535] New: Accepts Invalid: goto can skip declarations if they're labelled

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24535 Issue ID: 24535 Summary: Accepts Invalid: goto can skip declarations if they're labelled Product: D Version: D2 Hardware: x86 OS: Mac OS X Status

[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 Jonathan M Davis changed: What|Removed |Added Keywords||accepts-invalid --

[Issue 24534] New: Having a label on a declaration makes it possible to skip it with goto

2024-05-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24534 Issue ID: 24534 Summary: Having a label on a declaration makes it possible to skip it with goto Product: D Version: D2 Hardware: All OS: All Status

Re: Goto skipping declarations

2024-05-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 3, 2024 1:15:16 PM MDT Ben Jones via Digitalmars-d-learn wrote: > In general, you can't skip a declaration with goto, but it seems > to be allowed if the declaration you're skipping is labelled... > Is that expected or an accepts invalid bug? > > https://godbolt.

Goto skipping declarations

2024-05-03 Thread Ben Jones via Digitalmars-d-learn
In general, you can't skip a declaration with goto, but it seems to be allowed if the declaration you're skipping is labelled... Is that expected or an accepts invalid bug? https://godbolt.org/z/4qx8Pf6G7 ```d void f1(){ //fails with error about skipping a declaration int x; goto

[Issue 24460] scope(failure) with a goto breaks safety

2024-03-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 elpenguin...@gmail.com changed: What|Removed |Added See Also||https://issues.dlang.org/sh

[Issue 24460] scope(failure) with a goto breaks safety

2024-03-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 elpenguin...@gmail.com changed: What|Removed |Added See Also||https://issues.dlang.org/sh

[Issue 24460] scope(failure) with a goto breaks safety

2024-03-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 --- Comment #2 from RazvanN --- Scratch that. The problem is that you are not rethrowing the exception/error if you use a goto. --

[Issue 24460] scope(failure) with a goto breaks safety

2024-03-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #1 from

[Issue 24460] New: scope(failure) with a goto breaks safety

2024-03-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24460 Issue ID: 24460 Summary: scope(failure) with a goto breaks safety Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid, safe

[Issue 24356] goto case label not correctly generated by CTFE

2024-01-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24356 --- Comment #1 from Carl Sturtivant --- Created attachment 1904 --> https://issues.dlang.org/attachment.cgi?id=1904=edit Work around for goto case CTFE bug Shows that goto case does work with the computed label. --

[Issue 24356] New: goto case label not correctly generated by CTFE

2024-01-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24356 Issue ID: 24356 Summary: goto case label not correctly generated by CTFE Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal

[Issue 24291] ImportC: support computed goto

2023-12-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24291 --- Comment #9 from Walter Bright --- At least I can get you a better error message: https://github.com/dlang/dmd/pull/15967 --

[Issue 24291] ImportC: support computed goto

2023-12-29 Thread d-bugmail--- via Digitalmars-d-bugs
compile |ImportC: support computed |janet.c |goto OS|Linux |All --- Comment #8 from Walter Bright --- I'm going to leave this as an enhancement request for computed goto. If there are other ImportC problems with janet

[Issue 24174] [CTFE] goto within with statements & catch blocks cause a infinite loop

2023-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/dmd pull request #15651 "Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a infinite loop" was merged into master: - 62c233919c06e4d2aa79449f83b1bd52d84b0a11 by Mai-Lapyst: Fix issue 24174 - [CTF

[Issue 24174] [CTFE] goto within with statements & catch blocks cause a infinite loop

2023-10-04 Thread d-bugmail--- via Digitalmars-d-bugs
-Lapyst created dlang/dmd pull request #15651 "Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a infinite loop" fixing this issue: - Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a infinite loop https://github.com/dlang/dmd/pull/15651 --

[Issue 24174] New: [CTFE] goto within with statements & catch blocks cause a infinite loop

2023-10-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24174 Issue ID: 24174 Summary: [CTFE] goto within with statements & catch blocks cause a infinite loop Product: D Version: D2 Hardware: All OS: All St

[Issue 22688] Control flow analysis is confused by goto case in loop

2023-05-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22688 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@gmail.com --

[Issue 20179] 'goto' skips over declaration triggered for unused variable

2023-04-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20179 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #1 from

[Issue 21694] Misleading error message and invalid goto error

2023-02-06 Thread d-bugmail--- via Digitalmars-d-bugs
Treleaven --- run.dlang.io gives: 2.075.1 to 2.087.1: Failure with output: onlineapp.d(7): Error: `goto` skips declaration of variable `onlineapp.test.b` at onlineapp.d(9) Since 2.088.1: Failure with output: onlineapp.d(7): Error: cannot `goto` into `try` block Possibly related to Issue 20096

[Issue 22688] Control flow analysis is confused by goto case in loop

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22688 Iain Buclaw changed: What|Removed |Added Priority|P1 |P2 --

[Issue 21694] Misleading error message and invalid goto error

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21694 Iain Buclaw changed: What|Removed |Added Priority|P1 |P2 --

[Issue 21571] goto across assignment to AA fails and reports false Error

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21571 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 22995] goto case cannot forward to outer case label

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22995 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --

[Issue 20179] 'goto' skips over declaration triggered for unused variable

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20179 Iain Buclaw changed: What|Removed |Added Priority|P1 |P4 --

[Issue 23271] `goto` skips declaration of variable `bugred.A.test.__appendtmp4`

2022-07-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23271 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 23271] `goto` skips declaration of variable `bugred.A.test.__appendtmp4`

2022-07-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23271 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot ---

[Issue 23271] New: `goto` skips declaration of variable `bugred.A.test.__appendtmp4`

2022-07-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23271 Issue ID: 23271 Summary: `goto` skips declaration of variable `bugred.A.test.__appendtmp4` Product: D Version: D2 Hardware: All OS: All Status: NEW

[Issue 22995] New: goto case cannot forward to outer case label

2022-04-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22995 Issue ID: 22995 Summary: goto case cannot forward to outer case label Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor

[Issue 22933] importC: goto skips declaration of variable

2022-03-29 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/dmd pull request #13913 "fix Issue 22933 - importC: goto skips declaration of variable" was merged into master: - cd51b32e3c452e3a366430ed22ff7e006483dc9e by Walter Bright: fix Issue 22933 - importC: goto skips declaration o

[Issue 22933] importC: goto skips declaration of variable

2022-03-29 Thread d-bugmail--- via Digitalmars-d-bugs
--- @WalterBright created dlang/dmd pull request #13913 "fix Issue 22933 - importC: goto skips declaration of variable" fixing this issue: - fix Issue 22933 - importC: goto skips declaration of variable https://github.com/dlang/dmd/pull/13913 --

[Issue 22933] New: importC: goto skips declaration of variable

2022-03-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22933 Issue ID: 22933 Summary: importC: goto skips declaration of variable Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC, rejects-valid

[Issue 22688] Control flow analysis is confused by goto case in loop

2022-01-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22688 moonlightsenti...@disroot.org changed: What|Removed |Added CC||moonlightsentinel@disroot.o

[Issue 22688] New: Control flow analysis is confused by goto case in loop

2022-01-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22688 Issue ID: 22688 Summary: Control flow analysis is confused by goto case in loop Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: major

[Issue 22415] importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-12-14 Thread d-bugmail--- via Digitalmars-d-bugs
ssue 22415 - importC: Deprecation: switch case fallthrough - use 'goto case;' if intended * ImportC: improve parsing error message Co-authored-by: Walter Bright https://github.com/dlang/dmd/pull/13421 --

[Issue 22415] importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-11-22 Thread d-bugmail--- via Digitalmars-d-bugs
eprecation: switch case fallthrough - use 'goto case;' if intended https://github.com/dlang/dmd/pull/13344 --

[Issue 22415] importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
witch case fallthrough - use 'goto case;' if intended https://github.com/dlang/dmd/pull/13283 --

[Issue 22415] importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-11-11 Thread d-bugmail--- via Digitalmars-d-bugs
--- @WalterBright created dlang/dmd pull request #13283 "fix Issue 22415 - ImportC: Deprecation: switch case fallthrough - use…" fixing this issue: - fix Issue 22415 - importC: Deprecation: switch case fallthrough - use 'goto case;' if intended https://github.com/dlang/dmd/pull/13283 --

[Issue 22415] importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-10-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22415 Iain Buclaw changed: What|Removed |Added Keywords||diagnostic, ImportC, |

[Issue 22415] New: importC: Deprecation: switch case fallthrough - use 'goto case;' if intended

2021-10-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22415 Issue ID: 22415 Summary: importC: Deprecation: switch case fallthrough - use 'goto case;' if intended Product: D Version: D2 Hardware: All OS: All

[Issue 21985] "goto" errors with unexistent label report wrong/misleading line

2021-05-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21985 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 21985] "goto" errors with unexistent label report wrong/misleading line

2021-05-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21985 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot ---

[Issue 21985] "goto" errors with unexistent label report wrong/misleading line

2021-05-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21985 Basile-z changed: What|Removed |Added Keywords||diagnostic Severity|enhancement

[Issue 21985] New: "goto" errors with unexistent label report wrong/misleading line

2021-05-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21985 Issue ID: 21985 Summary: "goto" errors with unexistent label report wrong/misleading line Product: D Version: D2 Hardware: All OS: All S

[Issue 13815] Inconsistent goto jump behavior between compile-time and runtime

2021-04-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13815 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Issue 13815] Inconsistent goto jump behavior between compile-time and runtime

2021-04-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13815 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #1 from Dlang Bot ---

[Issue 21694] Misleading error message and invalid goto error

2021-03-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21694 --- Comment #2 from Răzvan Ștefănescu --- The error message is not swallowed because the code is lowered in a 'try {goto} finally', therefore there is no b declaration to jump over in the same scope as goto after lowering. If you replace the goto

[Issue 21694] Misleading error message and invalid goto error

2021-03-16 Thread d-bugmail--- via Digitalmars-d-bugs
RazvanN --- Actually, the goto is not legal because it skips the declaration of b. For example, this does not compile: struct A { /*~this() {}*/ } void test(int x) { { A a; goto END; } A b; END: } onlineapp.d(7): Error: goto skips declaration of variable onlineapp.test.b

[Issue 21694] New: Misleading error message and invalid goto error

2021-03-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21694 Issue ID: 21694 Summary: Misleading error message and invalid goto error Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major

[Issue 21571] goto across assignment to AA fails and reports false Error

2021-01-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21571 Stefan changed: What|Removed |Added CC||kde...@vogtner.de --

[Issue 21571] New: goto across assignment to AA fails and reports false Error

2021-01-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21571 Issue ID: 21571 Summary: goto across assignment to AA fails and reports false Error Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

Re: Simulating computed goto

2020-11-26 Thread NonNull via Digitalmars-d-learn
On Thursday, 26 November 2020 at 04:42:08 UTC, Dukc wrote: On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote: Is there a good way to simulate computed goto in D? I haven't used assembly myself, but it's possible that you can define a mixin that does this, using inline assembly

Re: Simulating computed goto

2020-11-26 Thread NonNull via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 18:57:35 UTC, Paul Backus wrote: On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote: How good is optimization in ldc2, gdc, dmd at compiling chained jumps into one jump each time? The easiest way to find the answer to a question like this is to

Re: Simulating computed goto

2020-11-26 Thread Dukc via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 20:05:28 UTC, NonNull wrote: So to simulate computed goto have to 1. wrap switch(x) in a loop [ while(0) ] 2. inside each case recompute x (instead of jump to computed y) 3. jump back to execute switch again [ continue ] It does look as if a nested switch can

Re: Simulating computed goto

2020-11-25 Thread Dukc via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote: Is there a good way to simulate computed goto in D? I haven't used assembly myself, but it's possible that you can define a mixin that does this, using inline assembly.

Re: Simulating computed goto

2020-11-25 Thread NonNull via Digitalmars-d-learn
any such chained jumps. But if performance is important to you, I recommend *not* bothering with dmd. Yes this is about efficiency. Is there a good way to simulate computed goto in D? With a switch statement. ;) OK, so I took a look at switch documentation and tried out something. It looked

Re: Simulating computed goto

2020-11-25 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 25, 2020 at 06:44:52PM +, NonNull via Digitalmars-d-learn wrote: > For automatically generated code of some low level kinds it is > convenient to have "computed goto" like this: > > https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html &g

Re: Simulating computed goto

2020-11-25 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote: How good is optimization in ldc2, gdc, dmd at compiling chained jumps into one jump each time? The easiest way to find the answer to a question like this is to use the compiler explorer: https://d.godbolt.org/

Simulating computed goto

2020-11-25 Thread NonNull via Digitalmars-d-learn
For automatically generated code of some low level kinds it is convenient to have "computed goto" like this: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html and D does not have this. A switch could be used to simulate it. But this would lead to what could have been a s

[Issue 20179] 'goto' skips over declaration triggered for unused variable

2020-08-06 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20179 Mathias LANG changed: What|Removed |Added OS|Mac OS X|All --

[Issue 20179] New: 'goto' skips over declaration triggered for unused variable

2019-08-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20179 Issue ID: 20179 Summary: 'goto' skips over declaration triggered for unused variable Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW

[Issue 20096] error message 'cannot goto into try block' is followed by seg fault

2019-08-07 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/dmd pull request #10266 "fix Issue 20096 - error message 'cannot goto into try block' is follo…" was merged into stable: - 4442cc705190b33b60bc3ed4ffe7d553f340b367 by Walter Bright: fix Issue 20096 - error message 'cannot got

[Issue 20096] error message 'cannot goto into try block' is followed by seg fault

2019-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
--- @WalterBright created dlang/dmd pull request #10266 "fix Issue 20096 - error message 'cannot goto into try block' is follo…" fixing this issue: - fix Issue 20096 - error message 'cannot goto into try block' is followed by seg fault https://github.com/dlang/dmd/pull/10266 --

[Issue 20096] error message 'cannot goto into try block' is followed by seg fault

2019-08-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20096 Walter Bright changed: What|Removed |Added Keywords||ice-on-invalid-code --

[Issue 20096] New: error message 'cannot goto into try block' is followed by seg fault

2019-08-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20096 Issue ID: 20096 Summary: error message 'cannot goto into try block' is followed by seg fault Product: D Version: D2 Hardware: All OS: All Status: NEW

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2019-01-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19213 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6572e4abb338127e2fd12cd562133e8f71a35311 Fix Issue 19213 - goto skips declaration of variable

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2019-01-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19213 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2018-12-19 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19213 --- Comment #6 from Eduard Staniloiu --- (In reply to kinke from comment #5) > While I'm not convinced the `goto`s in the `pop{Front,Back}EmptyElements` > mixins in Phobos are the most elegant way of expressing the logic, the

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2018-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
...@gmx.net --- While I'm not convinced the `goto`s in the `pop{Front,Back}EmptyElements` mixins in Phobos are the most elegant way of expressing the logic, the issue is that the frontend warns about a skipped *temporary* variable declaration, whose lifetime doesn't extend to the goto target. It may

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2018-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19213 --- Comment #4 from arne.lud...@posteo.de --- I reduced the example a bit more. The struct is not involved in the error. import std.algorithm; import std.range; void main() { auto results = [[1,2], [3,4]] .map!(q =>

[Issue 19213] goto skips declaration of variable in std.algorithm.iteration.joiner

2018-12-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19213 Eduard Staniloiu changed: What|Removed |Added CC||edi33...@gmail.com

[Issue 19011] visualD - not able to return to previous location after goto definition shortcut

2018-11-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19011 Rainer Schuetze changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

Re: Is this a bug? +goto

2018-11-09 Thread ShadoLight via Digitalmars-d-learn
On Thursday, 8 November 2018 at 09:34:34 UTC, Michelle Long wrote: What I am talking about is about an obvious error... OK, so here are your code slightly modified: void main(){ int i; W: if(i==0) goto Q; int x; Q: i++; if(i==1) goto W; writeln

Re: Is this a bug? +goto

2018-11-08 Thread Michelle Long via Digitalmars-d-learn
s been people talking passed each other without really coming to an understanding, which always makes for a frustrating discussion. The problem has to do with communication and assumptions. I'd like to help, but I don't know what else I can say. I've tried to explain how braces interact with goto

Re: Is this a bug? +goto

2018-11-08 Thread Jonathan M Davis via Digitalmars-d-learn
ding, which always makes for a frustrating discussion. I'd like to help, but I don't know what else I can say. I've tried to explain how braces interact with goto and why, so you should be able to figure out whether you're dealing with a compiler bug or not. And if you are, unless you're dealing with

Re: Is this a bug? +goto

2018-11-08 Thread Michelle Long via Digitalmars-d-learn
ong > via > > Digitalmars- d-learn wrote: >> Don't let their psychobabble fool you. They are wrong and >> you were right from the start. > > ... > >> Case A: >> { >> >> if (true) goto X; >> int x; >> >> } >>

Re: Is this a bug? +goto

2018-11-07 Thread Jonathan M Davis via Digitalmars-d-learn
learn wrote: > >> Don't let their psychobabble fool you. They are wrong and you > >> were right from the start. > > > > ... > > > >> Case A: > >> { > >> > >> if (true) goto X; > >> int x; > &g

Re: Is this a bug? +goto

2018-11-07 Thread Michelle Long via Digitalmars-d-learn
On Thursday, 8 November 2018 at 02:22:42 UTC, Jonathan M Davis wrote: On Wednesday, November 7, 2018 1:03:47 PM MST Michelle Long via Digitalmars- d-learn wrote: Don't let their psychobabble fool you. They are wrong and you were right from the start. ... Case A: { if (true) goto X

Re: Is this a bug? +goto

2018-11-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 7, 2018 1:03:47 PM MST Michelle Long via Digitalmars- d-learn wrote: > Don't let their psychobabble fool you. They are wrong and you > were right from the start. ... > Case A: > { > if (true) goto X; > int x; > } > X: > > > C

Re: Is this a bug? +goto

2018-11-07 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 7 November 2018 at 20:03:47 UTC, Michelle Long wrote: Case A: int x; { if (true) goto X; //int x; } ~x; X: That is not "Case A". This one is: { if (true) goto X; T x; X: } // x.__dtor That should error as an easy cop-out, nothing wrong with that

Re: Is this a bug? +goto

2018-11-07 Thread Michelle Long via Digitalmars-d-learn
And I found a bit strange that in such code, since "x" is >> never used, why it isn't skipped. > > It's skipped right over. The goto jumps out of the scope, > and the line with > > int x; > > is never run. In fact, if you compile with -w or -wi, th

Re: Is this a bug? +goto

2018-11-06 Thread MatheusBN via Digitalmars-d-learn
ot; is >> never used, why it isn't skipped. > > It's skipped right over. The goto jumps out of the scope, > and the line with > > int x; > > is never run. In fact, if you compile with -w or -wi, the > compiler will give you a warning about unreachable code. Tha

Re: Is this a bug? +goto

2018-11-05 Thread Jonathan M Davis via Digitalmars-d-learn
pped. > > > > It's skipped right over. The goto jumps out of the scope, and > > the line with > > > > int x; > > > > is never run. In fact, if you compile with -w or -wi, the > > compiler will give you a warning about unreachable code. > > That is ex

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
be enough instead of an error. On the other hand, if there is a possibility that the variable can be accessed, then an error should be throw. Like: { goto Q: int x; Q: x = 10; // An error is ok. } But here: { goto Q: int x; // An warning should be enough in my IMHO. Q

  1   2   3   4   5   >