comparison gcc/fortran/trans-const.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Translation of constants 1 /* Translation of constants
2 Copyright (C) 2002-2018 Free Software Foundation, Inc. 2 Copyright (C) 2002-2020 Free Software Foundation, Inc.
3 Contributed by Paul Brook 3 Contributed by Paul Brook
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it under 7 GCC is free software; you can redistribute it and/or modify it under
23 #include "config.h" 23 #include "config.h"
24 #include "system.h" 24 #include "system.h"
25 #include "coretypes.h" 25 #include "coretypes.h"
26 #include "tree.h" 26 #include "tree.h"
27 #include "gfortran.h" 27 #include "gfortran.h"
28 #include "options.h"
28 #include "trans.h" 29 #include "trans.h"
29 #include "fold-const.h" 30 #include "fold-const.h"
30 #include "stor-layout.h" 31 #include "stor-layout.h"
31 #include "realmpfr.h" 32 #include "realmpfr.h"
32 #include "trans-const.h" 33 #include "trans-const.h"
329 tree tmp = fold_build1_loc (input_location, VIEW_CONVERT_EXPR, 330 tree tmp = fold_build1_loc (input_location, VIEW_CONVERT_EXPR,
330 gfc_get_int_type (expr->ts.kind), 331 gfc_get_int_type (expr->ts.kind),
331 gfc_build_string_const (expr->representation.length, 332 gfc_build_string_const (expr->representation.length,
332 expr->representation.string)); 333 expr->representation.string));
333 if (!integer_zerop (tmp) && !integer_onep (tmp)) 334 if (!integer_zerop (tmp) && !integer_onep (tmp))
334 gfc_warning (0, "Assigning value other than 0 or 1 to LOGICAL" 335 gfc_warning (flag_dec_char_conversions ? OPT_Wsurprising : 0,
335 " has undefined result at %L", &expr->where); 336 "Assigning value other than 0 or 1 to LOGICAL has "
337 "undefined result at %L", &expr->where);
336 return fold_convert (gfc_get_logical_type (expr->ts.kind), tmp); 338 return fold_convert (gfc_get_logical_type (expr->ts.kind), tmp);
337 } 339 }
338 else 340 else
339 return build_int_cst (gfc_get_logical_type (expr->ts.kind), 341 return build_int_cst (gfc_get_logical_type (expr->ts.kind),
340 expr->value.logical); 342 expr->value.logical);