2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / fortran / target-memory.c
blob6b9292b5fafee97cbf8efac89f81fcf5890928bb
1 /* Simulate storage of variables into target memory.
2 Copyright (C) 2007-2018 Free Software Foundation, Inc.
3 Contributed by Paul Thomas and Brooks Moses
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tree.h"
25 #include "gfortran.h"
26 #include "trans.h"
27 #include "fold-const.h"
28 #include "stor-layout.h"
29 #include "arith.h"
30 #include "constructor.h"
31 #include "trans-const.h"
32 #include "trans-types.h"
33 #include "target-memory.h"
35 /* --------------------------------------------------------------- */
36 /* Calculate the size of an expression. */
39 static size_t
40 size_integer (int kind)
42 return GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (gfc_get_int_type (kind)));
46 static size_t
47 size_float (int kind)
49 return GET_MODE_SIZE (SCALAR_FLOAT_TYPE_MODE (gfc_get_real_type (kind)));
53 static size_t
54 size_complex (int kind)
56 return 2 * size_float (kind);
60 static size_t
61 size_logical (int kind)
63 return GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (gfc_get_logical_type (kind)));
67 static size_t
68 size_character (gfc_charlen_t length, int kind)
70 int i = gfc_validate_kind (BT_CHARACTER, kind, false);
71 return length * gfc_character_kinds[i].bit_size / 8;
75 /* Return the size of a single element of the given expression.
76 Identical to gfc_target_expr_size for scalars. */
78 size_t
79 gfc_element_size (gfc_expr *e)
81 tree type;
83 switch (e->ts.type)
85 case BT_INTEGER:
86 return size_integer (e->ts.kind);
87 case BT_REAL:
88 return size_float (e->ts.kind);
89 case BT_COMPLEX:
90 return size_complex (e->ts.kind);
91 case BT_LOGICAL:
92 return size_logical (e->ts.kind);
93 case BT_CHARACTER:
94 if (e->expr_type == EXPR_CONSTANT)
95 return size_character (e->value.character.length, e->ts.kind);
96 else if (e->ts.u.cl != NULL && e->ts.u.cl->length != NULL
97 && e->ts.u.cl->length->expr_type == EXPR_CONSTANT
98 && e->ts.u.cl->length->ts.type == BT_INTEGER)
100 HOST_WIDE_INT length;
102 gfc_extract_hwi (e->ts.u.cl->length, &length);
103 return size_character (length, e->ts.kind);
105 else
106 return 0;
108 case BT_HOLLERITH:
109 return e->representation.length;
110 case BT_DERIVED:
111 case BT_CLASS:
112 case BT_VOID:
113 case BT_ASSUMED:
115 /* Determine type size without clobbering the typespec for ISO C
116 binding types. */
117 gfc_typespec ts;
118 HOST_WIDE_INT size;
119 ts = e->ts;
120 type = gfc_typenode_for_spec (&ts);
121 size = int_size_in_bytes (type);
122 gcc_assert (size >= 0);
123 return size;
125 default:
126 gfc_internal_error ("Invalid expression in gfc_element_size.");
127 return 0;
132 /* Return the size of an expression in its target representation. */
134 size_t
135 gfc_target_expr_size (gfc_expr *e)
137 mpz_t tmp;
138 size_t asz;
140 gcc_assert (e != NULL);
142 if (e->rank)
144 if (gfc_array_size (e, &tmp))
145 asz = mpz_get_ui (tmp);
146 else
147 asz = 0;
149 else
150 asz = 1;
152 return asz * gfc_element_size (e);
156 /* The encode_* functions export a value into a buffer, and
157 return the number of bytes of the buffer that have been
158 used. */
160 static unsigned HOST_WIDE_INT
161 encode_array (gfc_expr *expr, unsigned char *buffer, size_t buffer_size)
163 mpz_t array_size;
164 int i;
165 int ptr = 0;
167 gfc_constructor_base ctor = expr->value.constructor;
169 gfc_array_size (expr, &array_size);
170 for (i = 0; i < (int)mpz_get_ui (array_size); i++)
172 ptr += gfc_target_encode_expr (gfc_constructor_lookup_expr (ctor, i),
173 &buffer[ptr], buffer_size - ptr);
176 mpz_clear (array_size);
177 return ptr;
181 static int
182 encode_integer (int kind, mpz_t integer, unsigned char *buffer,
183 size_t buffer_size)
185 return native_encode_expr (gfc_conv_mpz_to_tree (integer, kind),
186 buffer, buffer_size);
190 static int
191 encode_float (int kind, mpfr_t real, unsigned char *buffer, size_t buffer_size)
193 return native_encode_expr (gfc_conv_mpfr_to_tree (real, kind, 0), buffer,
194 buffer_size);
198 static int
199 encode_complex (int kind, mpc_t cmplx,
200 unsigned char *buffer, size_t buffer_size)
202 int size;
203 size = encode_float (kind, mpc_realref (cmplx), &buffer[0], buffer_size);
204 size += encode_float (kind, mpc_imagref (cmplx),
205 &buffer[size], buffer_size - size);
206 return size;
210 static int
211 encode_logical (int kind, int logical, unsigned char *buffer, size_t buffer_size)
213 return native_encode_expr (build_int_cst (gfc_get_logical_type (kind),
214 logical),
215 buffer, buffer_size);
219 size_t
220 gfc_encode_character (int kind, size_t length, const gfc_char_t *string,
221 unsigned char *buffer, size_t buffer_size)
223 size_t elsize = size_character (1, kind);
224 tree type = gfc_get_char_type (kind);
226 gcc_assert (buffer_size >= size_character (length, kind));
228 for (size_t i = 0; i < length; i++)
229 native_encode_expr (build_int_cst (type, string[i]), &buffer[i*elsize],
230 elsize);
232 return length;
236 static unsigned HOST_WIDE_INT
237 encode_derived (gfc_expr *source, unsigned char *buffer, size_t buffer_size)
239 gfc_constructor *c;
240 gfc_component *cmp;
241 int ptr;
242 tree type;
243 HOST_WIDE_INT size;
245 type = gfc_typenode_for_spec (&source->ts);
247 for (c = gfc_constructor_first (source->value.constructor),
248 cmp = source->ts.u.derived->components;
250 c = gfc_constructor_next (c), cmp = cmp->next)
252 gcc_assert (cmp);
253 if (!c->expr)
254 continue;
255 ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl))
256 + TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8;
258 if (c->expr->expr_type == EXPR_NULL)
260 size = int_size_in_bytes (TREE_TYPE (cmp->backend_decl));
261 gcc_assert (size >= 0);
262 memset (&buffer[ptr], 0, size);
264 else
265 gfc_target_encode_expr (c->expr, &buffer[ptr],
266 buffer_size - ptr);
269 size = int_size_in_bytes (type);
270 gcc_assert (size >= 0);
271 return size;
275 /* Write a constant expression in binary form to a buffer. */
276 unsigned HOST_WIDE_INT
277 gfc_target_encode_expr (gfc_expr *source, unsigned char *buffer,
278 size_t buffer_size)
280 if (source == NULL)
281 return 0;
283 if (source->expr_type == EXPR_ARRAY)
284 return encode_array (source, buffer, buffer_size);
286 gcc_assert (source->expr_type == EXPR_CONSTANT
287 || source->expr_type == EXPR_STRUCTURE
288 || source->expr_type == EXPR_SUBSTRING);
290 /* If we already have a target-memory representation, we use that rather
291 than recreating one. */
292 if (source->representation.string)
294 memcpy (buffer, source->representation.string,
295 source->representation.length);
296 return source->representation.length;
299 switch (source->ts.type)
301 case BT_INTEGER:
302 return encode_integer (source->ts.kind, source->value.integer, buffer,
303 buffer_size);
304 case BT_REAL:
305 return encode_float (source->ts.kind, source->value.real, buffer,
306 buffer_size);
307 case BT_COMPLEX:
308 return encode_complex (source->ts.kind, source->value.complex,
309 buffer, buffer_size);
310 case BT_LOGICAL:
311 return encode_logical (source->ts.kind, source->value.logical, buffer,
312 buffer_size);
313 case BT_CHARACTER:
314 if (source->expr_type == EXPR_CONSTANT || source->ref == NULL)
315 return gfc_encode_character (source->ts.kind,
316 source->value.character.length,
317 source->value.character.string,
318 buffer, buffer_size);
319 else
321 HOST_WIDE_INT start, end;
323 gcc_assert (source->expr_type == EXPR_SUBSTRING);
324 gfc_extract_hwi (source->ref->u.ss.start, &start);
325 gfc_extract_hwi (source->ref->u.ss.end, &end);
326 return gfc_encode_character (source->ts.kind, MAX(end - start + 1, 0),
327 &source->value.character.string[start-1],
328 buffer, buffer_size);
331 case BT_DERIVED:
332 if (source->ts.u.derived->ts.f90_type == BT_VOID)
334 gfc_constructor *c;
335 gcc_assert (source->expr_type == EXPR_STRUCTURE);
336 c = gfc_constructor_first (source->value.constructor);
337 gcc_assert (c->expr->expr_type == EXPR_CONSTANT
338 && c->expr->ts.type == BT_INTEGER);
339 return encode_integer (gfc_index_integer_kind, c->expr->value.integer,
340 buffer, buffer_size);
343 return encode_derived (source, buffer, buffer_size);
344 default:
345 gfc_internal_error ("Invalid expression in gfc_target_encode_expr.");
346 return 0;
351 static size_t
352 interpret_array (unsigned char *buffer, size_t buffer_size, gfc_expr *result)
354 gfc_constructor_base base = NULL;
355 size_t array_size = 1;
356 size_t ptr = 0;
358 /* Calculate array size from its shape and rank. */
359 gcc_assert (result->rank > 0 && result->shape);
361 for (int i = 0; i < result->rank; i++)
362 array_size *= mpz_get_ui (result->shape[i]);
364 /* Iterate over array elements, producing constructors. */
365 for (size_t i = 0; i < array_size; i++)
367 gfc_expr *e = gfc_get_constant_expr (result->ts.type, result->ts.kind,
368 &result->where);
369 e->ts = result->ts;
371 if (e->ts.type == BT_CHARACTER)
372 e->value.character.length = result->value.character.length;
374 gfc_constructor_append_expr (&base, e, &result->where);
376 ptr += gfc_target_interpret_expr (&buffer[ptr], buffer_size - ptr, e,
377 true);
380 result->value.constructor = base;
381 return ptr;
386 gfc_interpret_integer (int kind, unsigned char *buffer, size_t buffer_size,
387 mpz_t integer)
389 mpz_init (integer);
390 gfc_conv_tree_to_mpz (integer,
391 native_interpret_expr (gfc_get_int_type (kind),
392 buffer, buffer_size));
393 return size_integer (kind);
398 gfc_interpret_float (int kind, unsigned char *buffer, size_t buffer_size,
399 mpfr_t real)
401 gfc_set_model_kind (kind);
402 mpfr_init (real);
403 gfc_conv_tree_to_mpfr (real,
404 native_interpret_expr (gfc_get_real_type (kind),
405 buffer, buffer_size));
407 return size_float (kind);
412 gfc_interpret_complex (int kind, unsigned char *buffer, size_t buffer_size,
413 mpc_t complex)
415 int size;
416 size = gfc_interpret_float (kind, &buffer[0], buffer_size,
417 mpc_realref (complex));
418 size += gfc_interpret_float (kind, &buffer[size], buffer_size - size,
419 mpc_imagref (complex));
420 return size;
425 gfc_interpret_logical (int kind, unsigned char *buffer, size_t buffer_size,
426 int *logical)
428 tree t = native_interpret_expr (gfc_get_logical_type (kind), buffer,
429 buffer_size);
430 *logical = wi::to_wide (t) == 0 ? 0 : 1;
431 return size_logical (kind);
435 size_t
436 gfc_interpret_character (unsigned char *buffer, size_t buffer_size,
437 gfc_expr *result)
439 if (result->ts.u.cl && result->ts.u.cl->length)
440 result->value.character.length =
441 gfc_mpz_get_hwi (result->ts.u.cl->length->value.integer);
443 gcc_assert (buffer_size >= size_character (result->value.character.length,
444 result->ts.kind));
445 result->value.character.string =
446 gfc_get_wide_string (result->value.character.length + 1);
448 if (result->ts.kind == gfc_default_character_kind)
449 for (size_t i = 0; i < (size_t) result->value.character.length; i++)
450 result->value.character.string[i] = (gfc_char_t) buffer[i];
451 else
453 mpz_t integer;
454 size_t bytes = size_character (1, result->ts.kind);
455 mpz_init (integer);
456 gcc_assert (bytes <= sizeof (unsigned long));
458 for (size_t i = 0; i < (size_t) result->value.character.length; i++)
460 gfc_conv_tree_to_mpz (integer,
461 native_interpret_expr (gfc_get_char_type (result->ts.kind),
462 &buffer[bytes*i], buffer_size-bytes*i));
463 result->value.character.string[i]
464 = (gfc_char_t) mpz_get_ui (integer);
467 mpz_clear (integer);
470 result->value.character.string[result->value.character.length] = '\0';
472 return result->value.character.length;
477 gfc_interpret_derived (unsigned char *buffer, size_t buffer_size, gfc_expr *result)
479 gfc_component *cmp;
480 int ptr;
481 tree type;
483 /* The attributes of the derived type need to be bolted to the floor. */
484 result->expr_type = EXPR_STRUCTURE;
486 cmp = result->ts.u.derived->components;
488 if (result->ts.u.derived->from_intmod == INTMOD_ISO_C_BINDING
489 && (result->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR
490 || result->ts.u.derived->intmod_sym_id == ISOCBINDING_FUNPTR))
492 gfc_constructor *c;
493 gfc_expr *e;
494 /* Needed as gfc_typenode_for_spec as gfc_typenode_for_spec
495 sets this to BT_INTEGER. */
496 result->ts.type = BT_DERIVED;
497 e = gfc_get_constant_expr (cmp->ts.type, cmp->ts.kind, &result->where);
498 c = gfc_constructor_append_expr (&result->value.constructor, e, NULL);
499 c->n.component = cmp;
500 gfc_target_interpret_expr (buffer, buffer_size, e, true);
501 e->ts.is_iso_c = 1;
502 return int_size_in_bytes (ptr_type_node);
505 type = gfc_typenode_for_spec (&result->ts);
507 /* Run through the derived type components. */
508 for (;cmp; cmp = cmp->next)
510 gfc_constructor *c;
511 gfc_expr *e = gfc_get_constant_expr (cmp->ts.type, cmp->ts.kind,
512 &result->where);
513 e->ts = cmp->ts;
515 /* Copy shape, if needed. */
516 if (cmp->as && cmp->as->rank)
518 int n;
520 e->expr_type = EXPR_ARRAY;
521 e->rank = cmp->as->rank;
523 e->shape = gfc_get_shape (e->rank);
524 for (n = 0; n < e->rank; n++)
526 mpz_init_set_ui (e->shape[n], 1);
527 mpz_add (e->shape[n], e->shape[n],
528 cmp->as->upper[n]->value.integer);
529 mpz_sub (e->shape[n], e->shape[n],
530 cmp->as->lower[n]->value.integer);
534 c = gfc_constructor_append_expr (&result->value.constructor, e, NULL);
536 /* The constructor points to the component. */
537 c->n.component = cmp;
539 /* Calculate the offset, which consists of the FIELD_OFFSET in
540 bytes, which appears in multiples of DECL_OFFSET_ALIGN-bit-sized,
541 and additional bits of FIELD_BIT_OFFSET. The code assumes that all
542 sizes of the components are multiples of BITS_PER_UNIT,
543 i.e. there are, e.g., no bit fields. */
545 gcc_assert (cmp->backend_decl);
546 ptr = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (cmp->backend_decl));
547 gcc_assert (ptr % 8 == 0);
548 ptr = ptr/8 + TREE_INT_CST_LOW (DECL_FIELD_OFFSET (cmp->backend_decl));
550 gcc_assert (e->ts.type != BT_VOID || cmp->attr.caf_token);
551 gfc_target_interpret_expr (&buffer[ptr], buffer_size - ptr, e, true);
554 return int_size_in_bytes (type);
558 /* Read a binary buffer to a constant expression. */
559 size_t
560 gfc_target_interpret_expr (unsigned char *buffer, size_t buffer_size,
561 gfc_expr *result, bool convert_widechar)
563 if (result->expr_type == EXPR_ARRAY)
564 return interpret_array (buffer, buffer_size, result);
566 switch (result->ts.type)
568 case BT_INTEGER:
569 result->representation.length =
570 gfc_interpret_integer (result->ts.kind, buffer, buffer_size,
571 result->value.integer);
572 break;
574 case BT_REAL:
575 result->representation.length =
576 gfc_interpret_float (result->ts.kind, buffer, buffer_size,
577 result->value.real);
578 break;
580 case BT_COMPLEX:
581 result->representation.length =
582 gfc_interpret_complex (result->ts.kind, buffer, buffer_size,
583 result->value.complex);
584 break;
586 case BT_LOGICAL:
587 result->representation.length =
588 gfc_interpret_logical (result->ts.kind, buffer, buffer_size,
589 &result->value.logical);
590 break;
592 case BT_CHARACTER:
593 result->representation.length =
594 gfc_interpret_character (buffer, buffer_size, result);
595 break;
597 case BT_CLASS:
598 result->ts = CLASS_DATA (result)->ts;
599 /* Fall through. */
600 case BT_DERIVED:
601 result->representation.length =
602 gfc_interpret_derived (buffer, buffer_size, result);
603 gcc_assert (result->representation.length >= 0);
604 break;
606 case BT_VOID:
607 /* This deals with caf_tokens. */
608 result->representation.length =
609 gfc_interpret_integer (result->ts.kind, buffer, buffer_size,
610 result->value.integer);
611 break;
613 default:
614 gfc_internal_error ("Invalid expression in gfc_target_interpret_expr.");
615 break;
618 if (result->ts.type == BT_CHARACTER && convert_widechar)
619 result->representation.string
620 = gfc_widechar_to_char (result->value.character.string,
621 result->value.character.length);
622 else
624 result->representation.string =
625 XCNEWVEC (char, result->representation.length + 1);
626 memcpy (result->representation.string, buffer,
627 result->representation.length);
628 result->representation.string[result->representation.length] = '\0';
631 return result->representation.length;
635 /* --------------------------------------------------------------- */
636 /* Two functions used by trans-common.c to write overlapping
637 equivalence initializers to a buffer. This is added to the union
638 and the original initializers freed. */
641 /* Writes the values of a constant expression to a char buffer. If another
642 unequal initializer has already been written to the buffer, this is an
643 error. */
645 static size_t
646 expr_to_char (gfc_expr *e, locus *loc,
647 unsigned char *data, unsigned char *chk, size_t len)
649 int i;
650 int ptr;
651 gfc_constructor *c;
652 gfc_component *cmp;
653 unsigned char *buffer;
655 if (e == NULL)
656 return 0;
658 /* Take a derived type, one component at a time, using the offsets from the backend
659 declaration. */
660 if (e->ts.type == BT_DERIVED)
662 for (c = gfc_constructor_first (e->value.constructor),
663 cmp = e->ts.u.derived->components;
664 c; c = gfc_constructor_next (c), cmp = cmp->next)
666 gcc_assert (cmp && cmp->backend_decl);
667 if (!c->expr)
668 continue;
669 ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl))
670 + TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8;
671 expr_to_char (c->expr, loc, &data[ptr], &chk[ptr], len);
673 return len;
676 /* Otherwise, use the target-memory machinery to write a bitwise image, appropriate
677 to the target, in a buffer and check off the initialized part of the buffer. */
678 len = gfc_target_expr_size (e);
679 buffer = (unsigned char*)alloca (len);
680 len = gfc_target_encode_expr (e, buffer, len);
682 for (i = 0; i < (int)len; i++)
684 if (chk[i] && (buffer[i] != data[i]))
686 if (loc)
687 gfc_error ("Overlapping unequal initializers in EQUIVALENCE "
688 "at %L", loc);
689 else
690 gfc_error ("Overlapping unequal initializers in EQUIVALENCE "
691 "at %C");
692 return 0;
694 chk[i] = 0xFF;
697 memcpy (data, buffer, len);
698 return len;
702 /* Writes the values from the equivalence initializers to a char* array
703 that will be written to the constructor to make the initializer for
704 the union declaration. */
706 size_t
707 gfc_merge_initializers (gfc_typespec ts, gfc_expr *e, locus *loc,
708 unsigned char *data,
709 unsigned char *chk, size_t length)
711 size_t len = 0;
712 gfc_constructor * c;
714 switch (e->expr_type)
716 case EXPR_CONSTANT:
717 case EXPR_STRUCTURE:
718 len = expr_to_char (e, loc, &data[0], &chk[0], length);
719 break;
721 case EXPR_ARRAY:
722 for (c = gfc_constructor_first (e->value.constructor);
723 c; c = gfc_constructor_next (c))
725 size_t elt_size = gfc_target_expr_size (c->expr);
727 if (mpz_cmp_si (c->offset, 0) != 0)
728 len = elt_size * (size_t)mpz_get_si (c->offset);
730 len = len + gfc_merge_initializers (ts, c->expr, loc, &data[len],
731 &chk[len], length - len);
733 break;
735 default:
736 return 0;
739 return len;
743 /* Transfer the bitpattern of a (integer) BOZ to real or complex variables.
744 When successful, no BOZ or nothing to do, true is returned. */
746 bool
747 gfc_convert_boz (gfc_expr *expr, gfc_typespec *ts)
749 size_t buffer_size, boz_bit_size, ts_bit_size;
750 int index;
751 unsigned char *buffer;
753 if (!expr->is_boz)
754 return true;
756 gcc_assert (expr->expr_type == EXPR_CONSTANT
757 && expr->ts.type == BT_INTEGER);
759 /* Don't convert BOZ to logical, character, derived etc. */
760 if (ts->type == BT_REAL)
762 buffer_size = size_float (ts->kind);
763 ts_bit_size = buffer_size * 8;
765 else if (ts->type == BT_COMPLEX)
767 buffer_size = size_complex (ts->kind);
768 ts_bit_size = buffer_size * 8 / 2;
770 else
771 return true;
773 /* Convert BOZ to the smallest possible integer kind. */
774 boz_bit_size = mpz_sizeinbase (expr->value.integer, 2);
776 if (boz_bit_size > ts_bit_size)
778 gfc_error_now ("BOZ constant at %L is too large (%ld vs %ld bits)",
779 &expr->where, (long) boz_bit_size, (long) ts_bit_size);
780 return false;
783 for (index = 0; gfc_integer_kinds[index].kind != 0; ++index)
784 if ((unsigned) gfc_integer_kinds[index].bit_size >= ts_bit_size)
785 break;
787 expr->ts.kind = gfc_integer_kinds[index].kind;
788 buffer_size = MAX (buffer_size, size_integer (expr->ts.kind));
790 buffer = (unsigned char*)alloca (buffer_size);
791 encode_integer (expr->ts.kind, expr->value.integer, buffer, buffer_size);
792 mpz_clear (expr->value.integer);
794 if (ts->type == BT_REAL)
796 mpfr_init (expr->value.real);
797 gfc_interpret_float (ts->kind, buffer, buffer_size, expr->value.real);
799 else
801 mpc_init2 (expr->value.complex, mpfr_get_default_prec());
802 gfc_interpret_complex (ts->kind, buffer, buffer_size,
803 expr->value.complex);
805 expr->is_boz = 0;
806 expr->ts.type = ts->type;
807 expr->ts.kind = ts->kind;
809 return true;