[Issue 1041] regression: incorrect code generation for scope(exit) inside switch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 12 11:36:53 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=1041



--- Comment #7 from Iain Buclaw <ibuclaw at ubuntu.com> 2010-08-12 11:36:49 PDT ---
To be honest I was kinda unsure about this, as I did generally agree that this
should be valid for the reason that the body of a SwitchStatement is
ScopeStatement.

And although the code itself compiles it down to Figure 1 (which eventually
gets optimised to just 'i = i - 1;' anyway.), apparently it should be treated
more like Figure 2. Which has my hands half in the air in agreeing that it (the
current behaviour) probably shouldn't be the defined behaviour of the program.

What made me committed was this isn't seen in GCC-3.4. So at the very least,
need to fix up some bits to get some consistency across the board.


Figure 1:
# switch (3) {
#   default: goto <A>;
# }
# {
#   <A>:
#   {
#     try {
#     }
#     finally {
#       i = i - 1;
#     }
#   }
# }


Figure 2:
# switch (3) {
#   try {
#     default: goto <A>:
#   }
#   finally {
#     i = i - 1;
#   }
# }
# {
#   <A>:
#   {
#   }
# }

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


More information about the D.gnu mailing list