This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/10986] New: ICE caused by non-legal code (GOTO with real destination)


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10986

           Summary: ICE caused by non-legal code (GOTO with real
                    destination)
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P5
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bdavis9659@comcast.net
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: powerpc-unknown-netbsd1.6
  GCC host triplet: powerpc-unknown-netbsd1.6
GCC target triplet: powerpc-unknown-netbsd1.6

Two instances of non-legal code that causes an ICE:

newbug.f
       ASSIGN 1 TO A
       GOTO A
 1     CONTINUE
       END
newbug2.f
      goto a 
      end

Results:

[bdavis@f77 ~]$ /usr/local/bin/g77 newbug.f
newbug.f: In program `MAIN__':
newbug.f:1: 
          ASSIGN 1 TO A
                      ^
Expression at (^) has incorrect data type or rank for its context
newbug.f:2: 
          GOTO A
               ^
Expression at (^) has incorrect data type or rank for its context
newbug.f:1: internal compiler error: tree check: expected class 't', have 'x'
(error_mark) in ffeste_R838, at f/ste.c:2956
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

[bdavis@f77 ~]$ /usr/local/bin/g77 newbug2.f
newbug2.f: In program `MAIN__':
newbug2.f:1: 
         goto a 
              ^
Expression at (^) has incorrect data type or rank for its context
newbug2.f:1: internal compiler error: tree check: expected class 't', have 'x'
(error_mark) in ffeste_R839, at f/ste.c:2984
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

They do not ICE with gcc-2.95

The patch to fix this is below

Index: gcc/gcc/f/ste.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/f/ste.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 ste.c
*** gcc/gcc/f/ste.c	3 May 2003 16:39:50 -0000	1.36
--- gcc/gcc/f/ste.c	27 May 2003 01:28:15 -0000
*************** ffeste_R838 (ffelab label, ffebld target
*** 2950,2965 ****
        TREE_CONSTANT (label_tree) = 1;
  
        target_tree = ffecom_expr_assign_w (target);
!       if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (target_tree)))
! 	  < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (label_tree))))
! 	error ("ASSIGN to variable that is too small");
  
!       label_tree = convert (TREE_TYPE (target_tree), label_tree);
  
!       expr_tree = ffecom_modify (void_type_node,
  				 target_tree,
  				 label_tree);
!       expand_expr_stmt (expr_tree);
      }
  }
  
--- 2950,2968 ----
        TREE_CONSTANT (label_tree) = 1;
  
        target_tree = ffecom_expr_assign_w (target);
!       if (TREE_CODE (target_tree)!= ERROR_MARK)
!       {
!         if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (target_tree)))
!             < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (label_tree))))
! 	  error ("ASSIGN to variable that is too small");
  
!         label_tree = convert (TREE_TYPE (target_tree), label_tree);
  
!         expr_tree = ffecom_modify (void_type_node,
  				 target_tree,
  				 label_tree);
!         expand_expr_stmt (expr_tree);
!       }
      }
  }
  
*************** ffeste_R839 (ffebld target)
*** 2978,2988 ****
       seen here should never require use of temporaries.  */
  
    t = ffecom_expr_assign (target);
-   if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t)))
-       < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node))))
-     error ("ASSIGNed GOTO target variable is too small");
  
!   expand_computed_goto (convert (TREE_TYPE (null_pointer_node), t));
  }
  
  /* Arithmetic IF statement.  */
--- 2981,2995 ----
       seen here should never require use of temporaries.  */
  
    t = ffecom_expr_assign (target);
  
!   if (TREE_CODE (t) != ERROR_MARK)
!   {
!        if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (t)))
!          < GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (null_pointer_node))))
!        error ("ASSIGNed GOTO target variable is too small");
! 
!        expand_computed_goto (convert (TREE_TYPE (null_pointer_node), t));
!   }
  }
  
  /* Arithmetic IF statement.  */



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]