https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79153

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This isn't really that easy, because what we end up with in the IL that Marek's
infrastructure looks at is for switches that may fall through (i.e. ones which
have either a break; stmt or missing default) is just a GIMPLE_LABEL created
for the LABEL_EXPR added already in the FEs, or the:
      if (!default_case)
        {
          glabel *new_default;

          default_case
            = build_case_label (NULL_TREE, NULL_TREE,
                                create_artificial_label (UNKNOWN_LOCATION));
          new_default = gimple_build_label (CASE_LABEL (default_case));
          gimplify_seq_add_stmt (&switch_body_seq, new_default);
        }
added GIMPLE_LABEL, then lots of stmts in between and finally some
GIMPLE_SWITCH.

So, I think the gimplify.c fallthrough code needs to be told what GIMPLE_LABEL
stmts are the break labels or default case labels and for diagnostics it would
be nice if it could be possible to query the locus of the corresponding switch
stmt and then treat a GIMPLE_LABEL with that special flag just as a statement
that can fall through with the location of the corresponding GIMPLE_SWITCH.

Finding an available bit on LABEL_DECL should be easy, e.g. protected_flag
doesn't seem to be occupied.  As for location, not really sure what code cares
about gimple_location of GIMPLE_LABEL / EXPR_LOCATION of LABEL_EXPR and what
code cares about DECL_LOCATION of a LABEL_DECL and if we could reuse one or the
other to hold the location of the switch, without e.g. the debugger jumping on
back to the switch when we do a break.

Reply via email to