Blame SOURCES/0011-Allow-character-to-int-conversions-in-DATA-statement.patch

2985e0
From ced1b6638459f33dc9f22a0cd959f97c05a62e22 Mon Sep 17 00:00:00 2001
2985e0
From: Jim MacArthur <jim.macarthur@codethink.co.uk>
2985e0
Date: Wed, 7 Oct 2015 18:23:31 -0400
2985e0
Subject: [PATCH 11/23] Allow character-to-int conversions in DATA statements
2985e0
2985e0
This feature is enabled by the `-std=extra-legacy` compiler flag.
2985e0
---
2985e0
2985e0
    0011-Allow-character-to-int-conversions-in-DATA-statement.patch
2985e0
2985e0
commit 11b148af8967669bcebd91ea6fdae28e9ec8e97c
2985e0
Author: Jim MacArthur <jim.macarthur@codethink.co.uk>
2985e0
Date:   Wed Oct 7 18:23:31 2015 -0400
2985e0
2985e0
    Allow character-to-int conversions in DATA statements
2985e0
    
2985e0
    This feature is enabled by the `-std=extra-legacy` compiler flag.
2985e0
    
2985e0
    Test written by: Francisco Redondo Marchena <francisco.marchena@codethink.co.uk>
2985e0
2985e0
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
2985e0
index f347c753702..9982b8d0e85 100644
2985e0
--- a/gcc/fortran/expr.c
2985e0
+++ b/gcc/fortran/expr.c
2985e0
@@ -3294,6 +3294,10 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform,
2985e0
 	  || rvalue->ts.type == BT_HOLLERITH)
2985e0
 	return true;
2985e0
 
2985e0
+      if ((gfc_option.allow_std & GFC_STD_EXTRA_LEGACY)
2985e0
+	  && gfc_numeric_ts (&lvalue->ts) && rvalue->ts.type == BT_CHARACTER)
2985e0
+	return true;
2985e0
+
2985e0
       if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
2985e0
 	return true;
2985e0
 
2985e0
diff --git a/gcc/testsuite/gfortran.dg/dec_char_to_int_conversion_in_data.f b/gcc/testsuite/gfortran.dg/dec_char_to_int_conversion_in_data.f
2985e0
new file mode 100644
2985e0
index 00000000000..e0e4f735243
2985e0
--- /dev/null
2985e0
+++ b/gcc/testsuite/gfortran.dg/dec_char_to_int_conversion_in_data.f
2985e0
@@ -0,0 +1,11 @@
2985e0
+! { dg-do compile }
2985e0
+! { dg-options "-std=extra-legacy" }
2985e0
+!
2985e0
+! Test character to int conversion in DATA types
2985e0
+!
2985e0
+        PROGRAM char_int_data_type
2985e0
+          INTEGER*1 ai(2)
2985e0
+
2985e0
+          DATA ai/'1',1/
2985e0
+          if(ai(1).NE.49) STOP 1
2985e0
+        END