SPHM1RT doesn't compile with 2 or 3 photon groups
SPHM1RT fails to compile with 2 photon groups:
rt/SPHM1RT/rt_cooling.c: In function 'rt_do_thermochemistry':
rt/SPHM1RT/rt_cooling.c:138:32: error: iteration 1 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
138 | (double)(rho_cgs * urad[g + 1] * conv_factor_internal_energy_to_cgs /
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:136:21: note: within this loop
136 | for (int g = 0; g < 3; g++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:309:31: error: iteration 1 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:308:25: note: within this loop
308 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:294:25: error: iteration 1 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
294 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:293:25: note: within this loop
293 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:496:31: error: iteration 1 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:495:25: note: within this loop
495 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:481:25: error: iteration 1 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
481 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:480:25: note: within this loop
480 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:309:31: error: array subscript 2 is above array bounds of 'float[2]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:309:17: error: array subscript 2 is above array bounds of 'float[2]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:290:11: note: while referencing 'urad_new'
290 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:309:31: error: array subscript 3 is above array bounds of 'float[2]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:309:17: error: array subscript 3 is above array bounds of 'float[2]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:290:11: note: while referencing 'urad_new'
290 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:496:31: error: array subscript 2 is above array bounds of 'float[2]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:496:17: error: array subscript 2 is above array bounds of 'float[2]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:477:11: note: while referencing 'urad_new'
477 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:496:31: error: array subscript 3 is above array bounds of 'float[2]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:496:17: error: array subscript 3 is above array bounds of 'float[2]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:477:11: note: while referencing 'urad_new'
477 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
and with 3 groups
rt/SPHM1RT/rt_cooling.c: In function 'rt_do_thermochemistry':
rt/SPHM1RT/rt_cooling.c:138:32: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
138 | (double)(rho_cgs * urad[g + 1] * conv_factor_internal_energy_to_cgs /
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:136:21: note: within this loop
136 | for (int g = 0; g < 3; g++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:309:31: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:308:25: note: within this loop
308 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:294:25: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
294 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:293:25: note: within this loop
293 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:496:31: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:495:25: note: within this loop
495 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:481:25: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
481 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:480:25: note: within this loop
480 | for (int i = 0; i < 3; i++) {
| ~~^~~
rt/SPHM1RT/rt_cooling.c:309:31: error: array subscript 3 is above array bounds of 'float[3]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:309:17: error: array subscript 3 is above array bounds of 'float[3]' [-Werror=array-bounds]
309 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:290:11: note: while referencing 'urad_new'
290 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:496:31: error: array subscript 3 is above array bounds of 'float[3]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:130:9: note: while referencing 'urad'
130 | float urad[RT_NGROUPS];
| ^~~~
rt/SPHM1RT/rt_cooling.c:496:17: error: array subscript 3 is above array bounds of 'float[3]' [-Werror=array-bounds]
496 | urad_new[i + 1] = urad[i + 1];
| ~~~~~~~~^~~~~~~
rt/SPHM1RT/rt_cooling.c:477:11: note: while referencing 'urad_new'
477 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:294:25: error: '__builtin_memset' forming offset [12, 15] is out of the bounds [0, 12] of object 'urad_new' with type 'float[3]' [-Werror=array-bounds]
294 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:290:11: note: 'urad_new' declared here
290 | float urad_new[RT_NGROUPS];
| ^~~~~~~~
rt/SPHM1RT/rt_cooling.c:481:25: error: '__builtin_memset' forming offset [12, 15] is out of the bounds [0, 12] of object 'urad_new' with type 'float[3]' [-Werror=array-bounds]
481 | urad_new[i + 1] = 0.f;
| ~~~~~~~~~~~~~~~~^~~~~
rt/SPHM1RT/rt_cooling.c:477:11: note: 'urad_new' declared here
477 | float urad_new[RT_NGROUPS];
| ^~~~~~~~