TRAVERSE ERROR: node of type N_num found where N_id was expected!
|
|
Bugzilla Link |
597 |
Created on |
Nov 18, 2009 15:25 |
Resolution |
FIXED |
Resolved on |
Nov 18, 2009 17:45 |
Version |
1.00beta |
OS |
Linux |
Architecture |
PC |
Extended Description
The code causes the bug only within a development version of the compiler, product version works fine.
BugReport:
/**********************************************************************
*
* SAC bug report: tmp.sacbugreport
*
**********************************************************************
*
* Automatically generated on Wed Nov 18 15:20:36 GMT 2009
*
* using sac2c v1.00-beta (Buchette d'Anjou) rev 16581 for linux-gnu_i686
* built Wed Nov 18 14:44:32 GMT 2009.
* by user asv on host obelix for linux-gnu.
*
* The compiler was called by
* sac2c /tmp/tmp.UdFjX16385
*
* The compiler crashed in
* phase: mem (Introducing memory management instructions)
* sub phase: dr (Exploiting data reuse)
*
* What follows is the contents of /tmp/tmp.UdFjX16385.
*
**********************************************************************/
# 1 "qsort_lazy.sac"
# 1 ""
# 1 ""
# 1 "qsort_lazy.sac"
use Array: all;
# 1 "benchmarking.h" 1
# 28 "benchmarking.h"
use StdIO: all;
# 7 "qsort_lazy.sac" 2
# 26 "qsort_lazy.sac"
int main()
{
x = reverse(rotate([5], iota(200)));
SIZE = 200;
res = quicksort(x, SIZE);
# 40 "qsort_lazy.sac"
print(res[0]);
return( 0);
}
int[.] quicksort(int[.] in, int n) {
return (_quicksort(take([n], in)));
}
int[.] _quicksort(int[.] in)
{
if( shape( in)[0] == 0) {
returnVal = [];
}
else {
pivot = in[0];
list = drop( [1], in);
returnVal =
_quicksort( filterLT( list, pivot)) ++
[pivot] ++
_quicksort( filterGT( list, pivot));
}
return( returnVal);
}
int[.] filterGT( int[.] A, int p)
{
B = genarray([shape(A)[0]], 0);
count = 0;
for (i=0; i< shape(A)[0]; i++) {
if (A[i] >= p) {
B[count] = A[i];
count += 1;
}
}
return (take([count], B));
}
int[.] filterLT( int[.] A, int p)
{
B = genarray([shape(A)[0]], 0);
count = 0;
for (i=0; i< shape(A)[0]; i++) {
if (A[i] < p) {
B[count] = A[i];
count += 1;
}
}
return (take([count], B));
}
/**********************************************************************
*
* End of bug report
*
**********************************************************************/