-nowlur causes wrong answer at run-time
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/crud$ sac2c crud.sac -dowlur -DBAD This works fine, with the following result at the tail:
a.out
...
A_38 timesreduce arg, result is:
Dimension: 1
Shape : < 2>
< 1 2 >
Dimension: 0
Shape : < >
2
prod(A_37), result is:
Dimension: 0
Shape : < >
2
However, if I compile it with:
sac2c crud.sac -nowlur -DBAD
A_38 timesreduce arg, result is:
Dimension: 1
Shape : < 2>
< 1 2 >
Dimension: 0
Shape : < >
1
prod(A_37), result is:
Dimension: 0
Shape : < >
1
Compiling with "-d treecheck -chkfreq 4" finds several problems.
**** Type stabilization cycle pass: 1
****** Optimizing regular function:
****** _MAIN::main( hidden, hidden, hidden): ...
Applying type upgrade ...
-> Running syntax tree checks
Internal compiler error
Assertion "NODE_TYPE( arg_node)== N_module || global.local_funs_grouped" failed at /home/sac/sac2c/build_d/src/libsac2c/check_reset.c:44 -- If run fun-based, special funs must be grouped.
and lots of these:
AVIS_SSAASSIGN is does not point to correct N_assign node for N_ids
Warning:
AVIS_SSAASSIGN does not point to correct N_assign node
Warning:
attribute ID_WL must be NULL
Similarly, if I compile with -check a, a.out executes without crashing, so no help there.
In the check_reset.c crash, arg_node is an N_fundef, and global.local.funs_grouped is false, yet according to sac2c -h, all but one of the traversals in scyc are fun-based.
sac2c_d -V
sac2c 1.3.3-MijasCosta-1047-g0c4a5
build-type: DEBUG
built-by: "sac" at 2023-02-15T14:33:53
Looking at -bopt code gave me a headache, so I welcome ideas.