This is another spin-off from my master post (which I will link in a minute), the following code leads to a segmentation violation with nvfortran (v23.0)
The reproducer is here:
test_part_spec.f90 (25.5 KB)
with the following backtrace,
Program received signal SIGSEGV, Segmentation fault.
iso_varying_string::len_ () at main_ut.f90:71
71 if(ALLOCATED(string%chars)) then
(gdb) bt
#0 iso_varying_string::len_ () at main_ut.f90:71
#1 0x000000000040297a in iso_varying_string::op_concat_vs_vs () at main_ut.f90:116
#2 0x000000000040734b in particle_specifiers::prt_spec_to_string () at main_ut.f90:483
#3 0x0000000000408020 in particle_specifiers::prt_spec_list_to_string () at main_ut.f90:529
#4 0x000000000040b2a9 in particle_specifiers::prt_spec_sum_to_string () at main_ut.f90:637
#5 0x0000000000403aca in particle_specifiers::prt_expr_to_string () at main_ut.f90:362
#6 0x000000000041290d in particle_specifiers_uti::particle_specifiers_2 () at main_ut.f90:855
#7 0x0000000000414162 in main_ut () at main_ut.f90:900
while it should give the following output:
* Test output: particle_specifiers_2
* Purpose: Create and display particle expressions
* Basic expressions
a
a + b
a, b
* Nested expressions
a + b, c
(a, b), c
a + (b + c)
a + (b, c), d
(a, b) + (c, d)
a + b, c, d + e + f
* Expand as sum
a
(a, c) + (b, c)
a, b, c
a + b + c
(a, d) + (b, c, d)
(a, b) + (c, d)
(a, c, d) + (a, c, e) + (a, c, f) + (b, c, d) + (b, c, e) + (b, c, f)
* Transform to arrays:
* Atomic specifier
a
* List
a, b, c
* Sum of atoms
a
b
c
* Sum of lists
a, c, d
a, c, e
a, c, f
b, c, d
b, c, e
b, c, f