spread_generic.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /* Generic implementation of the SPREAD intrinsic
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Contributed by Paul Brook <paul@nowt.org>
  4. This file is part of the GNU Fortran runtime library (libgfortran).
  5. Libgfortran is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public
  7. License as published by the Free Software Foundation; either
  8. version 3 of the License, or (at your option) any later version.
  9. Ligbfortran is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. #include "libgfortran.h"
  21. #include <stdlib.h>
  22. #include <assert.h>
  23. #include <string.h>
  24. static void
  25. spread_internal (gfc_array_char *ret, const gfc_array_char *source,
  26. const index_type *along, const index_type *pncopies)
  27. {
  28. /* r.* indicates the return array. */
  29. index_type rstride[GFC_MAX_DIMENSIONS];
  30. index_type rstride0;
  31. index_type rdelta = 0;
  32. index_type rrank;
  33. index_type rs;
  34. char *rptr;
  35. char *dest;
  36. /* s.* indicates the source array. */
  37. index_type sstride[GFC_MAX_DIMENSIONS];
  38. index_type sstride0;
  39. index_type srank;
  40. const char *sptr;
  41. index_type count[GFC_MAX_DIMENSIONS];
  42. index_type extent[GFC_MAX_DIMENSIONS];
  43. index_type n;
  44. index_type dim;
  45. index_type ncopies;
  46. index_type size;
  47. size = GFC_DESCRIPTOR_SIZE(source);
  48. srank = GFC_DESCRIPTOR_RANK(source);
  49. rrank = srank + 1;
  50. if (rrank > GFC_MAX_DIMENSIONS)
  51. runtime_error ("return rank too large in spread()");
  52. if (*along > rrank)
  53. runtime_error ("dim outside of rank in spread()");
  54. ncopies = *pncopies;
  55. if (ret->base_addr == NULL)
  56. {
  57. /* The front end has signalled that we need to populate the
  58. return array descriptor. */
  59. size_t ub, stride;
  60. ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank;
  61. dim = 0;
  62. rs = 1;
  63. for (n = 0; n < rrank; n++)
  64. {
  65. stride = rs;
  66. if (n == *along - 1)
  67. {
  68. ub = ncopies - 1;
  69. rdelta = rs * size;
  70. rs *= ncopies;
  71. }
  72. else
  73. {
  74. count[dim] = 0;
  75. extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
  76. sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
  77. rstride[dim] = rs * size;
  78. ub = extent[dim]-1;
  79. rs *= extent[dim];
  80. dim++;
  81. }
  82. GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
  83. }
  84. ret->offset = 0;
  85. ret->base_addr = xmallocarray (rs, size);
  86. if (rs <= 0)
  87. return;
  88. }
  89. else
  90. {
  91. int zero_sized;
  92. zero_sized = 0;
  93. dim = 0;
  94. if (GFC_DESCRIPTOR_RANK(ret) != rrank)
  95. runtime_error ("rank mismatch in spread()");
  96. if (compile_options.bounds_check)
  97. {
  98. for (n = 0; n < rrank; n++)
  99. {
  100. index_type ret_extent;
  101. ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
  102. if (n == *along - 1)
  103. {
  104. rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
  105. if (ret_extent != ncopies)
  106. runtime_error("Incorrect extent in return value of SPREAD"
  107. " intrinsic in dimension %ld: is %ld,"
  108. " should be %ld", (long int) n+1,
  109. (long int) ret_extent, (long int) ncopies);
  110. }
  111. else
  112. {
  113. count[dim] = 0;
  114. extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
  115. if (ret_extent != extent[dim])
  116. runtime_error("Incorrect extent in return value of SPREAD"
  117. " intrinsic in dimension %ld: is %ld,"
  118. " should be %ld", (long int) n+1,
  119. (long int) ret_extent,
  120. (long int) extent[dim]);
  121. if (extent[dim] <= 0)
  122. zero_sized = 1;
  123. sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
  124. rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
  125. dim++;
  126. }
  127. }
  128. }
  129. else
  130. {
  131. for (n = 0; n < rrank; n++)
  132. {
  133. if (n == *along - 1)
  134. {
  135. rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
  136. }
  137. else
  138. {
  139. count[dim] = 0;
  140. extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
  141. if (extent[dim] <= 0)
  142. zero_sized = 1;
  143. sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
  144. rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
  145. dim++;
  146. }
  147. }
  148. }
  149. if (zero_sized)
  150. return;
  151. if (sstride[0] == 0)
  152. sstride[0] = size;
  153. }
  154. sstride0 = sstride[0];
  155. rstride0 = rstride[0];
  156. rptr = ret->base_addr;
  157. sptr = source->base_addr;
  158. while (sptr)
  159. {
  160. /* Spread this element. */
  161. dest = rptr;
  162. for (n = 0; n < ncopies; n++)
  163. {
  164. memcpy (dest, sptr, size);
  165. dest += rdelta;
  166. }
  167. /* Advance to the next element. */
  168. sptr += sstride0;
  169. rptr += rstride0;
  170. count[0]++;
  171. n = 0;
  172. while (count[n] == extent[n])
  173. {
  174. /* When we get to the end of a dimension, reset it and increment
  175. the next dimension. */
  176. count[n] = 0;
  177. /* We could precalculate these products, but this is a less
  178. frequently used path so probably not worth it. */
  179. sptr -= sstride[n] * extent[n];
  180. rptr -= rstride[n] * extent[n];
  181. n++;
  182. if (n >= srank)
  183. {
  184. /* Break out of the loop. */
  185. sptr = NULL;
  186. break;
  187. }
  188. else
  189. {
  190. count[n]++;
  191. sptr += sstride[n];
  192. rptr += rstride[n];
  193. }
  194. }
  195. }
  196. }
  197. /* This version of spread_internal treats the special case of a scalar
  198. source. This is much simpler than the more general case above. */
  199. static void
  200. spread_internal_scalar (gfc_array_char *ret, const char *source,
  201. const index_type *along, const index_type *pncopies)
  202. {
  203. int n;
  204. int ncopies = *pncopies;
  205. char * dest;
  206. size_t size;
  207. size = GFC_DESCRIPTOR_SIZE(ret);
  208. if (GFC_DESCRIPTOR_RANK (ret) != 1)
  209. runtime_error ("incorrect destination rank in spread()");
  210. if (*along > 1)
  211. runtime_error ("dim outside of rank in spread()");
  212. if (ret->base_addr == NULL)
  213. {
  214. ret->base_addr = xmallocarray (ncopies, size);
  215. ret->offset = 0;
  216. GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
  217. }
  218. else
  219. {
  220. if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1)
  221. / GFC_DESCRIPTOR_STRIDE(ret,0))
  222. runtime_error ("dim too large in spread()");
  223. }
  224. for (n = 0; n < ncopies; n++)
  225. {
  226. dest = (char*)(ret->base_addr + n * GFC_DESCRIPTOR_STRIDE_BYTES(ret,0));
  227. memcpy (dest , source, size);
  228. }
  229. }
  230. extern void spread (gfc_array_char *, const gfc_array_char *,
  231. const index_type *, const index_type *);
  232. export_proto(spread);
  233. void
  234. spread (gfc_array_char *ret, const gfc_array_char *source,
  235. const index_type *along, const index_type *pncopies)
  236. {
  237. index_type type_size;
  238. type_size = GFC_DTYPE_TYPE_SIZE(ret);
  239. switch(type_size)
  240. {
  241. case GFC_DTYPE_DERIVED_1:
  242. case GFC_DTYPE_LOGICAL_1:
  243. case GFC_DTYPE_INTEGER_1:
  244. spread_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) source,
  245. *along, *pncopies);
  246. return;
  247. case GFC_DTYPE_LOGICAL_2:
  248. case GFC_DTYPE_INTEGER_2:
  249. spread_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) source,
  250. *along, *pncopies);
  251. return;
  252. case GFC_DTYPE_LOGICAL_4:
  253. case GFC_DTYPE_INTEGER_4:
  254. spread_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) source,
  255. *along, *pncopies);
  256. return;
  257. case GFC_DTYPE_LOGICAL_8:
  258. case GFC_DTYPE_INTEGER_8:
  259. spread_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) source,
  260. *along, *pncopies);
  261. return;
  262. #ifdef HAVE_GFC_INTEGER_16
  263. case GFC_DTYPE_LOGICAL_16:
  264. case GFC_DTYPE_INTEGER_16:
  265. spread_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) source,
  266. *along, *pncopies);
  267. return;
  268. #endif
  269. case GFC_DTYPE_REAL_4:
  270. spread_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) source,
  271. *along, *pncopies);
  272. return;
  273. case GFC_DTYPE_REAL_8:
  274. spread_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) source,
  275. *along, *pncopies);
  276. return;
  277. /* FIXME: This here is a hack, which will have to be removed when
  278. the array descriptor is reworked. Currently, we don't store the
  279. kind value for the type, but only the size. Because on targets with
  280. __float128, we have sizeof(logn double) == sizeof(__float128),
  281. we cannot discriminate here and have to fall back to the generic
  282. handling (which is suboptimal). */
  283. #if !defined(GFC_REAL_16_IS_FLOAT128)
  284. # ifdef GFC_HAVE_REAL_10
  285. case GFC_DTYPE_REAL_10:
  286. spread_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) source,
  287. *along, *pncopies);
  288. return;
  289. # endif
  290. # ifdef GFC_HAVE_REAL_16
  291. case GFC_DTYPE_REAL_16:
  292. spread_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) source,
  293. *along, *pncopies);
  294. return;
  295. # endif
  296. #endif
  297. case GFC_DTYPE_COMPLEX_4:
  298. spread_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) source,
  299. *along, *pncopies);
  300. return;
  301. case GFC_DTYPE_COMPLEX_8:
  302. spread_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) source,
  303. *along, *pncopies);
  304. return;
  305. /* FIXME: This here is a hack, which will have to be removed when
  306. the array descriptor is reworked. Currently, we don't store the
  307. kind value for the type, but only the size. Because on targets with
  308. __float128, we have sizeof(logn double) == sizeof(__float128),
  309. we cannot discriminate here and have to fall back to the generic
  310. handling (which is suboptimal). */
  311. #if !defined(GFC_REAL_16_IS_FLOAT128)
  312. # ifdef GFC_HAVE_COMPLEX_10
  313. case GFC_DTYPE_COMPLEX_10:
  314. spread_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) source,
  315. *along, *pncopies);
  316. return;
  317. # endif
  318. # ifdef GFC_HAVE_COMPLEX_16
  319. case GFC_DTYPE_COMPLEX_16:
  320. spread_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) source,
  321. *along, *pncopies);
  322. return;
  323. # endif
  324. #endif
  325. case GFC_DTYPE_DERIVED_2:
  326. if (GFC_UNALIGNED_2(ret->base_addr) || GFC_UNALIGNED_2(source->base_addr))
  327. break;
  328. else
  329. {
  330. spread_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) source,
  331. *along, *pncopies);
  332. return;
  333. }
  334. case GFC_DTYPE_DERIVED_4:
  335. if (GFC_UNALIGNED_4(ret->base_addr) || GFC_UNALIGNED_4(source->base_addr))
  336. break;
  337. else
  338. {
  339. spread_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) source,
  340. *along, *pncopies);
  341. return;
  342. }
  343. case GFC_DTYPE_DERIVED_8:
  344. if (GFC_UNALIGNED_8(ret->base_addr) || GFC_UNALIGNED_8(source->base_addr))
  345. break;
  346. else
  347. {
  348. spread_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) source,
  349. *along, *pncopies);
  350. return;
  351. }
  352. #ifdef HAVE_GFC_INTEGER_16
  353. case GFC_DTYPE_DERIVED_16:
  354. if (GFC_UNALIGNED_16(ret->base_addr)
  355. || GFC_UNALIGNED_16(source->base_addr))
  356. break;
  357. else
  358. {
  359. spread_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) source,
  360. *along, *pncopies);
  361. return;
  362. }
  363. #endif
  364. }
  365. spread_internal (ret, source, along, pncopies);
  366. }
  367. extern void spread_char (gfc_array_char *, GFC_INTEGER_4,
  368. const gfc_array_char *, const index_type *,
  369. const index_type *, GFC_INTEGER_4);
  370. export_proto(spread_char);
  371. void
  372. spread_char (gfc_array_char *ret,
  373. GFC_INTEGER_4 ret_length __attribute__((unused)),
  374. const gfc_array_char *source, const index_type *along,
  375. const index_type *pncopies,
  376. GFC_INTEGER_4 source_length __attribute__((unused)))
  377. {
  378. spread_internal (ret, source, along, pncopies);
  379. }
  380. extern void spread_char4 (gfc_array_char *, GFC_INTEGER_4,
  381. const gfc_array_char *, const index_type *,
  382. const index_type *, GFC_INTEGER_4);
  383. export_proto(spread_char4);
  384. void
  385. spread_char4 (gfc_array_char *ret,
  386. GFC_INTEGER_4 ret_length __attribute__((unused)),
  387. const gfc_array_char *source, const index_type *along,
  388. const index_type *pncopies,
  389. GFC_INTEGER_4 source_length __attribute__((unused)))
  390. {
  391. spread_internal (ret, source, along, pncopies);
  392. }
  393. /* The following are the prototypes for the versions of spread with a
  394. scalar source. */
  395. extern void spread_scalar (gfc_array_char *, const char *,
  396. const index_type *, const index_type *);
  397. export_proto(spread_scalar);
  398. void
  399. spread_scalar (gfc_array_char *ret, const char *source,
  400. const index_type *along, const index_type *pncopies)
  401. {
  402. index_type type_size;
  403. if (!ret->dtype)
  404. runtime_error ("return array missing descriptor in spread()");
  405. type_size = GFC_DTYPE_TYPE_SIZE(ret);
  406. switch(type_size)
  407. {
  408. case GFC_DTYPE_DERIVED_1:
  409. case GFC_DTYPE_LOGICAL_1:
  410. case GFC_DTYPE_INTEGER_1:
  411. spread_scalar_i1 ((gfc_array_i1 *) ret, (GFC_INTEGER_1 *) source,
  412. *along, *pncopies);
  413. return;
  414. case GFC_DTYPE_LOGICAL_2:
  415. case GFC_DTYPE_INTEGER_2:
  416. spread_scalar_i2 ((gfc_array_i2 *) ret, (GFC_INTEGER_2 *) source,
  417. *along, *pncopies);
  418. return;
  419. case GFC_DTYPE_LOGICAL_4:
  420. case GFC_DTYPE_INTEGER_4:
  421. spread_scalar_i4 ((gfc_array_i4 *) ret, (GFC_INTEGER_4 *) source,
  422. *along, *pncopies);
  423. return;
  424. case GFC_DTYPE_LOGICAL_8:
  425. case GFC_DTYPE_INTEGER_8:
  426. spread_scalar_i8 ((gfc_array_i8 *) ret, (GFC_INTEGER_8 *) source,
  427. *along, *pncopies);
  428. return;
  429. #ifdef HAVE_GFC_INTEGER_16
  430. case GFC_DTYPE_LOGICAL_16:
  431. case GFC_DTYPE_INTEGER_16:
  432. spread_scalar_i16 ((gfc_array_i16 *) ret, (GFC_INTEGER_16 *) source,
  433. *along, *pncopies);
  434. return;
  435. #endif
  436. case GFC_DTYPE_REAL_4:
  437. spread_scalar_r4 ((gfc_array_r4 *) ret, (GFC_REAL_4 *) source,
  438. *along, *pncopies);
  439. return;
  440. case GFC_DTYPE_REAL_8:
  441. spread_scalar_r8 ((gfc_array_r8 *) ret, (GFC_REAL_8 *) source,
  442. *along, *pncopies);
  443. return;
  444. /* FIXME: This here is a hack, which will have to be removed when
  445. the array descriptor is reworked. Currently, we don't store the
  446. kind value for the type, but only the size. Because on targets with
  447. __float128, we have sizeof(logn double) == sizeof(__float128),
  448. we cannot discriminate here and have to fall back to the generic
  449. handling (which is suboptimal). */
  450. #if !defined(GFC_REAL_16_IS_FLOAT128)
  451. # ifdef HAVE_GFC_REAL_10
  452. case GFC_DTYPE_REAL_10:
  453. spread_scalar_r10 ((gfc_array_r10 *) ret, (GFC_REAL_10 *) source,
  454. *along, *pncopies);
  455. return;
  456. # endif
  457. # ifdef HAVE_GFC_REAL_16
  458. case GFC_DTYPE_REAL_16:
  459. spread_scalar_r16 ((gfc_array_r16 *) ret, (GFC_REAL_16 *) source,
  460. *along, *pncopies);
  461. return;
  462. # endif
  463. #endif
  464. case GFC_DTYPE_COMPLEX_4:
  465. spread_scalar_c4 ((gfc_array_c4 *) ret, (GFC_COMPLEX_4 *) source,
  466. *along, *pncopies);
  467. return;
  468. case GFC_DTYPE_COMPLEX_8:
  469. spread_scalar_c8 ((gfc_array_c8 *) ret, (GFC_COMPLEX_8 *) source,
  470. *along, *pncopies);
  471. return;
  472. /* FIXME: This here is a hack, which will have to be removed when
  473. the array descriptor is reworked. Currently, we don't store the
  474. kind value for the type, but only the size. Because on targets with
  475. __float128, we have sizeof(logn double) == sizeof(__float128),
  476. we cannot discriminate here and have to fall back to the generic
  477. handling (which is suboptimal). */
  478. #if !defined(GFC_REAL_16_IS_FLOAT128)
  479. # ifdef HAVE_GFC_COMPLEX_10
  480. case GFC_DTYPE_COMPLEX_10:
  481. spread_scalar_c10 ((gfc_array_c10 *) ret, (GFC_COMPLEX_10 *) source,
  482. *along, *pncopies);
  483. return;
  484. # endif
  485. # ifdef HAVE_GFC_COMPLEX_16
  486. case GFC_DTYPE_COMPLEX_16:
  487. spread_scalar_c16 ((gfc_array_c16 *) ret, (GFC_COMPLEX_16 *) source,
  488. *along, *pncopies);
  489. return;
  490. # endif
  491. #endif
  492. case GFC_DTYPE_DERIVED_2:
  493. if (GFC_UNALIGNED_2(ret->base_addr) || GFC_UNALIGNED_2(source))
  494. break;
  495. else
  496. {
  497. spread_scalar_i2 ((gfc_array_i2 *) ret, (GFC_INTEGER_2 *) source,
  498. *along, *pncopies);
  499. return;
  500. }
  501. case GFC_DTYPE_DERIVED_4:
  502. if (GFC_UNALIGNED_4(ret->base_addr) || GFC_UNALIGNED_4(source))
  503. break;
  504. else
  505. {
  506. spread_scalar_i4 ((gfc_array_i4 *) ret, (GFC_INTEGER_4 *) source,
  507. *along, *pncopies);
  508. return;
  509. }
  510. case GFC_DTYPE_DERIVED_8:
  511. if (GFC_UNALIGNED_8(ret->base_addr) || GFC_UNALIGNED_8(source))
  512. break;
  513. else
  514. {
  515. spread_scalar_i8 ((gfc_array_i8 *) ret, (GFC_INTEGER_8 *) source,
  516. *along, *pncopies);
  517. return;
  518. }
  519. #ifdef HAVE_GFC_INTEGER_16
  520. case GFC_DTYPE_DERIVED_16:
  521. if (GFC_UNALIGNED_16(ret->base_addr) || GFC_UNALIGNED_16(source))
  522. break;
  523. else
  524. {
  525. spread_scalar_i16 ((gfc_array_i16 *) ret, (GFC_INTEGER_16 *) source,
  526. *along, *pncopies);
  527. return;
  528. }
  529. #endif
  530. }
  531. spread_internal_scalar (ret, source, along, pncopies);
  532. }
  533. extern void spread_char_scalar (gfc_array_char *, GFC_INTEGER_4,
  534. const char *, const index_type *,
  535. const index_type *, GFC_INTEGER_4);
  536. export_proto(spread_char_scalar);
  537. void
  538. spread_char_scalar (gfc_array_char *ret,
  539. GFC_INTEGER_4 ret_length __attribute__((unused)),
  540. const char *source, const index_type *along,
  541. const index_type *pncopies,
  542. GFC_INTEGER_4 source_length __attribute__((unused)))
  543. {
  544. if (!ret->dtype)
  545. runtime_error ("return array missing descriptor in spread()");
  546. spread_internal_scalar (ret, source, along, pncopies);
  547. }
  548. extern void spread_char4_scalar (gfc_array_char *, GFC_INTEGER_4,
  549. const char *, const index_type *,
  550. const index_type *, GFC_INTEGER_4);
  551. export_proto(spread_char4_scalar);
  552. void
  553. spread_char4_scalar (gfc_array_char *ret,
  554. GFC_INTEGER_4 ret_length __attribute__((unused)),
  555. const char *source, const index_type *along,
  556. const index_type *pncopies,
  557. GFC_INTEGER_4 source_length __attribute__((unused)))
  558. {
  559. if (!ret->dtype)
  560. runtime_error ("return array missing descriptor in spread()");
  561. spread_internal_scalar (ret, source, along, pncopies);
  562. }