Tutorial code crashes sac2c (Listing 20)
Bugzilla Link | 1195 |
Created on | Jun 13, 2017 23:33 |
Resolution | FIXED |
Resolved on | Jun 20, 2017 19:55 |
Version | svn |
OS | Linux |
Architecture | PC |
Attachments | bugbug_no.sac |
Extended Description
Created an attachment (id=1061) bugbug_no.sac I tried to compile the tutorial example (Listing 20: Relaxation with Cyclic Boundaries) in part 2.2.3 from the tutorial on sac-home.org (http://www.sac-home.org/doku.php?id=docs:tutorial#Ch2.S2.SS3). the compiler exits with the message :
sac2c hw8.sac
Internal compiler error
Assertion "cviv[0] < cvshp[0]" failed at /var/jenkins/workspace/sac2c-packages/cudas/cuda-8.0/label/RHEL7/packs/RPM/phmo/ON/src/libsac2c/constants/constants_struc_ops.c:1262 -- Index error: iv[0] >= shp([0]
Please file a bug at: http://bugs.sac-home.org
I was able to reduce the code to (bugbug_no.sac)
use StdIO: all;
use Array: all;
int main()
{
weights = [0,0,0];
vect = [1, 0,0,0];
erg = { iv -> weights[iv] + rotate(iv, vect)};
print(erg);
return 0;
}
If I apply any of the following changes, sac2c runs without error:
line6: a shorter array
weights = [0,0]
line7: a zero array
vect = [0, 0,0,0]
line7: a shorter array
vect = [1,0,0]
line9: a fix rotate value
... rotate([100], vect) ...
line9: removing the rotate
erg = { iv -> weights[iv] + vect};
line9: replacing the rotate
erg = { iv -> weights[iv] + shift(iv, 42, vect)};
line10 removing print
I'm using the sac2c version (sac2c -help): "1.2-beta-BlackForest-467-gce8d4" downloaded via AUR. on a Arch linux (uname -a) "Linux Andromeda 4.11.3-1-ARCH #1 SMP PREEMPT Sun May 28 10:40:17 CEST 2017 x86_64 GNU/Linux" the SacBase/Stdlib was downloaded today (2017-06-14) from github. related bugs: I'm not sure if bug report "Bug 1042" is the same issue or not.