Comments (7)
Hi there,
Thanks for the feedback. I just wanted to check if you are using the latest version? Because the line number 763 in your trace correspond to the "}" statement for me.
Cheers,
Gagandeep Singh
from elina.
Sorry for the confusion. I added some printf
to the file in order to find the bug and I forgot to delete them before running Valgrind. Now I've updated the initial comment with the correct line numbers.
I hope you could find now the bug.
My apologies and thanks again,
Marius.
from elina.
Hi Marius,
Thanks for the update. I am unable to locate the problem, however if you could print the following variables after this line (
ELINA/elina_poly/opt_pk_assign.c
Line 302 in 20857f8
- nbrows
- nbvertex
- nbline
- poly[res]->intdim
Cheers,
Gagandeep Singh
from elina.
Hi Gagandeep,
First of all, sorry for taking so long to reply. I have been quite busy the past few days.
In my program the function opt_poly_asssub_linexpr_det
is invoked twice.
In the next code, I list the values of the variables that I have printed after the line
ELINA/elina_poly/opt_pk_assign.c
Line 302 in 20857f8
BEGIN opt_poly_asssub_linexpr_det
nbrows: 0
nbvertex: 0
nbline: 1
poly[res]->intdim: 1
BEGIN opt_poly_asssub_linexpr_det
free(): invalid next size (fast)
However, in the second invocation, the if
condition
ELINA/elina_poly/opt_pk_assign.c
Line 300 in 20857f8
Finally, the program crash on the line
ELINA/elina_poly/opt_pk_assign.c
Line 563 in 20857f8
Next, I list the data of
poly_a[k]
variable that I've printed just before calling this function:
poly_a[k] data:
intdim: 1
realdim: 0
nbeq: 1
nbline: 0
is_minimized: 0
status: 0
C.nbcolumns: 3
C.nbrows: 1
F.nbcolumns: 3
F.nbrows: 1
satC.nbcolumns: 1
satC.nbrows: 1
calling opt_poly_clear(poly_a[k]); ...
free(): invalid next size (fast)
If I try to print the nbcolumns
and nbrows
fields of the satF
I get a segmentation fault. So, it could be that the problem is in the matrix allocation.
Thank you for all the effort you are putting into solving the problem.
Regards,
Marius.
from elina.
Hi there,
Thanks for the information. I pushed a fix, let me know if the issue is resolved. If not, can you print me the C and F matrix before the crash along with the value of "k" and "num_compa" as well as uncommenting all of he following lines:
ELINA/elina_poly/opt_pk_assign.c
Line 121 in 20857f8
Cheers,
Gagandeep Singh
from elina.
Hi Gagandeep,
it is still not working. It continues to crash in the same line as in previous comments. But don't worry, in the upcoming days, I will check my code to make sure that the crash is not caused by my code.
Anyway, I show you the modifications I have made in the code and the output I get.
I list below the body of this for:
ELINA/elina_poly/opt_pk_assign.c
Line 561 in 9248e87
for(k=0; k < num_compa;k++){
printf("poly_a[k] data for k=%d, num_compa=%d:\n", k, num_compa);
printf("intdim: %d\n", poly_a[k]->intdim);
printf("realdim: %d\n", poly_a[k]->realdim);
printf("nbeq: %ld\n", poly_a[k]->nbeq);
printf("nbline: %ld\n", poly_a[k]->nbline);
printf("is_minimized: %d\n", poly_a[k]->is_minimized);
printf("status: %d\n", poly_a[k]->status);
printf("C->nbcolumns: %d\n", poly_a[k]->C->nbcolumns);
printf("C->nbrows: %ld\n", poly_a[k]->C->nbrows);
printf("F->nbcolumns: %d\n", poly_a[k]->F->nbcolumns);
printf("F->nbrows: %ld\n", poly_a[k]->F->nbrows);
printf("satC->nbcolumns: %ld\n", poly_a[k]->satC->nbcolumns);
printf("satC->nbrows: %ld\n", poly_a[k]->satC->nbrows);
if(!disjoint_map[k]){
printf("calling opt_poly_clear(poly_a[k])...\n");
opt_poly_clear(poly_a[k]);
printf("Call to opt_poly_clear(poly_a[k]) completed\n");
}
free(poly_a[k]);
}
In addition, I've uncommented the 8 lines that follow this
ELINA/elina_poly/opt_pk_assign.c
Line 121 in 9248e87
The end of the
opt_poly_asssub_linexpr_det
function looks like this:
op->poly = poly;
op->acl = acl;
free(exc_map);
printf("ASSIGN OUTPUT\n");
// print_array_comp_list(acl,op->maxcols);
elina_lincons0_array_t arr1 = opt_pk_to_lincons_array(man,op);
elina_lincons0_array_fprint(stdout, &arr1, NULL);
// elina_lincons0_array_clear(&arr1);
fflush(stdout);
printf("Exiting from opt_poly_asssub_linexpr_det");
return op;
I can't uncomment this two functions ( print_array_comp_list(acl,op->maxcols)
and elina_lincons0_array_clear(&arr1)
) because it crashes if I do it.
With this code, I get this results:
ASSIGN INPUT
0
empty array of constraints
x0:= 2147483648
ASSIGN OUTPUT
1
array of constraints of size 1
0: -x0 + 2147483648 = 0
Exiting from opt_poly_asssub_linexpr_det
ASSIGN INPUT
1
array of constraints of size 1
0: -x0 + 2147483648 = 0
x1:= x0
1
c
3
poly_a[k] data for k=0, num_compa=1:
intdim: 1
realdim: 0
nbeq: 1
nbline: 0
is_minimized: 0
status: 0
C->nbcolumns: 3
C->nbrows: 1
F->nbcolumns: 3
F->nbrows: 1
satC->nbcolumns: 1
satC->nbrows: 1
calling opt_poly_clear(poly_a[k])...
free(): invalid next size (fast)
In the following days, I will take a look at my code and I will notify you to close the issues or to give you more details about the bug.
Thank you,
Marius.
from elina.
Hi Marius,
Based on your trace, I created a sample program below which produces the same trace but did not observe any crash:
void test_assign(unsigned short int dim, size_t nbcons){
elina_manager_t * man = opt_pk_manager_alloc(false);
opt_pk_array_t * oa1 = opt_pk_top(man, 2,0);
//generate random constraints
elina_dim_t * tdim = (elina_dim_t *)malloc(sizeof(elina_dim_t));
tdim[0] = 0;
elina_linexpr0_t ** expr_array = (elina_linexpr0_t**)malloc(sizeof(elina_linexpr0_t*));
//elina_linexpr0_t * linexpr0 = generate_random_linexpr0(dim);
elina_coeff_t *cst, *coeff;
elina_linexpr0_t * linexpr0 = elina_linexpr0_alloc(ELINA_LINEXPR_SPARSE,0);
cst = &linexpr0->cst;
elina_scalar_set_to_int(cst->val.scalar,2147483648,ELINA_SCALAR_MPQ);
expr_array[0] = linexpr0;
printf("ELINA Input Polyhedron\n");
elina_lincons0_array_t arr1 = opt_pk_to_lincons_array(man,oa1);
elina_lincons0_array_fprint(stdout,&arr1,NULL);
printf("Assignment statement\n");
printf("x%d = ",tdim[0]);
elina_linexpr0_fprint(stdout,linexpr0,NULL);
printf("\n");
fflush(stdout);
elina_lincons0_array_clear(&arr1);
//assign;
opt_pk_assign_linexpr_array(man,true,oa1,tdim, expr_array,1,NULL);
elina_linexpr0_free(linexpr0);
// Print the result
printf("ELINA Output Polyhedron\n");
elina_lincons0_array_t arr = opt_pk_to_lincons_array(man,oa1);
elina_lincons0_array_fprint(stdout,&arr,NULL);
printf("\n");
fflush(stdout);
elina_lincons0_array_clear(&arr);
tdim[0] = 1;
linexpr0 = elina_linexpr0_alloc(ELINA_LINEXPR_SPARSE,1);
cst = &linexpr0->cst;
//int r = rand()%10;
elina_scalar_set_to_int(cst->val.scalar,0,ELINA_SCALAR_MPQ);
elina_linterm_t * linterm = &linexpr0->p.linterm[0];
linterm->dim = 0;
coeff = &linterm->coeff;
elina_scalar_set_to_int(coeff->val.scalar,1,ELINA_SCALAR_MPQ);
expr_array[0] = linexpr0;
//opt_pk_array_t * oa3 =
opt_pk_assign_linexpr_array(man,true,oa1,tdim, expr_array,1,NULL);
printf("ELINA Output Polyhedron\n");
arr = opt_pk_to_lincons_array(man,oa1);
elina_lincons0_array_fprint(stdout,&arr,NULL);
printf("\n");
fflush(stdout);
elina_lincons0_array_clear(&arr);
free(expr_array);
free(tdim);
opt_pk_free(man,oa1);
elina_manager_free(man);
}
Make sure that you create polyhedra with >=2 variables as I did when calling the top function. Let me know if it helps.
Cheers,
Gagandeep Singh
from elina.
Related Issues (20)
- clang: error: unknown argument: '-mno-fused-madd' HOT 2
- elina_abstract0_from_zonotope is not defined
- Compilation failure due to wrong path HOT 4
- Segfault when creating a polyhedra using a tcons_array HOT 1
- Broken ELINA after 9c99c4d177c691f98f2031657c18fe6fbe4c7571 HOT 1
- Adding a new variable and interval to Poly HOT 4
- Meet/Join with different dims? HOT 5
- Makefile in fppoly references non-existant sign_approx.o HOT 1
- Wrong CDD_PREFIX after ./configure --cdd-prefix HOT 4
- OSError: libfppoly.so: cannot open shared object file: No such file or directory HOT 4
- error: ‘AP_SCALAR_MPFR’ undeclared (first use in this function); did you mean ‘ELINA_SCALAR_MPFR’? HOT 2
- error when executing make in ELINA HOT 2
- Get relative bounds for dimensions HOT 2
- SEGFAULT when joining bottom HOT 4
- Portability issue with the `funptr` array HOT 7
- -march=native and -DTIMING not supported in Apple M1 HOT 3
- Missing MPFR_LIB_FLAG and GMP_LIB_FLAG in Makefile HOT 2
- How to tune the clam options to reproduce ELINA paper results HOT 14
- Does ELINA support the join and meet operators in case of the NNC Polyhedra? HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elina.