Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Pb with a simple pointer allocation


  • Subject: [Frama-c-discuss] Pb with a simple pointer allocation
  • From: gava at univ-paris12.fr (Frédéric Gava)
  • Date: Thu, 29 Apr 2010 00:53:30 +0200
  • In-reply-to: <4BD8BB3D.30201@univ-paris-est.fr>
  • References: <mailman.87.1272448828.12130.frama-c-discuss@lists.gforge.inria.fr> <4BD8BB3D.30201@univ-paris-est.fr>

Dear Frama-C users,

Here a simple program that could not be proved by Alt-Ergo and Z3:

#include <limits.h>

#define SZDBL (sizeof(double))

/*@ lemma is_peraps_needed :
@ \forall integer m, n; 0<m ==> 0<n ==> n<(m*n);
@*/

/*@
requires m>0 && n>0 && m*n<LONG_MAX;
*/
double **matallocd(int m, int n){
double *pd, **ppd;
ppd= (double **)malloc(m*sizeof(double *));
pd= (double *)malloc(m*n*SZDBL);
ppd[0]=pd;
/*@ assert \valid_range(ppd[0],0,n-1); */
}


If someone have a solution...

Note that in my true program, I used "ppd[i]= ppd[i-1]+n" forall 1<=i<m

Thanks,
FG