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

--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> ---
(In reply to Anastasios Vathis from comment #2)
> In any case, there sould be a " SYNTAX ERROR" issued

It's not an error, the case can simply never match. If you compile
with -Wall you get a warning:

$ gfortran t.f90  -Wall
t.f90:27.23:

         CASE ('2':'7','9':'0')
                       1
Warning: Range specification at (1) can never be matched
$ 

Problem is a simple list walk error if the unreachable case is the
last in the list.  Plugged with the following patch.


Index: resolve.c
===================================================================
--- resolve.c   (revision 214292)
+++ resolve.c   (working copy)
@@ -7761,7 +7761,7 @@ resolve_select (gfc_code *code, bool select_type)
        /* Strip all other unreachable cases.  */
        if (body->ext.block.case_list)
          {
-           for (cp = body->ext.block.case_list; cp->next; cp = cp->next)
+           for (cp = body->ext.block.case_list; cp && cp->next; cp = cp->next)
              {
                if (cp->next->unreachable)
                  {

Reply via email to