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