aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-const.c
diff options
context:
space:
mode:
authorMark Eggleston <mark.eggleston@codethink.com>2019-11-08 14:28:57 +0000
committerMark Eggleston <markeggleston@gcc.gnu.org>2019-11-08 14:28:57 +0000
commit2afeb1ca38dbb7c8708272452417426e46b4d6ed (patch)
tree64a5d856971870bc05da3d569128a278bcffa3a5 /gcc/fortran/trans-const.c
parent4e9d58d16767b1bc686f0c4b3bd2da25dc71e8f3 (diff)
downloadgcc-2afeb1ca38dbb7c8708272452417426e46b4d6ed.zip
gcc-2afeb1ca38dbb7c8708272452417426e46b4d6ed.tar.gz
gcc-2afeb1ca38dbb7c8708272452417426e46b4d6ed.tar.bz2
Allow CHARACTER literals in assignments and data statements.
Allows character literals to used to assign values to non-character variables in the same way that Hollerith constants are used. In addition character literals can be used in data statements just like Hollerith constants. Warnings of such use are output to discourage this usage as it is a non-standard legacy feature and must be explicitly enabled. Enabled by -fdec and -fdec-char-conversions. Co-Authored-By: Jim MacArthur <jim.macarthur@codethink.co.uk> From-SVN: r277975
Diffstat (limited to 'gcc/fortran/trans-const.c')
-rw-r--r--gcc/fortran/trans-const.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 432d12b..7ce0263 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree.h"
#include "gfortran.h"
+#include "options.h"
#include "trans.h"
#include "fold-const.h"
#include "stor-layout.h"
@@ -331,8 +332,9 @@ gfc_conv_constant_to_tree (gfc_expr * expr)
gfc_build_string_const (expr->representation.length,
expr->representation.string));
if (!integer_zerop (tmp) && !integer_onep (tmp))
- gfc_warning (0, "Assigning value other than 0 or 1 to LOGICAL"
- " has undefined result at %L", &expr->where);
+ gfc_warning (flag_dec_char_conversions ? OPT_Wsurprising : 0,
+ "Assigning value other than 0 or 1 to LOGICAL has "
+ "undefined result at %L", &expr->where);
return fold_convert (gfc_get_logical_type (expr->ts.kind), tmp);
}
else