--- rpl/src/algebre_lineaire1.c 2013/02/27 17:11:39 1.41 +++ rpl/src/algebre_lineaire1.c 2013/03/20 17:11:42 1.42 @@ -49,15 +49,14 @@ inversion_matrice(struct_processus *s_et integer4 erreur; integer4 *pivot; + integer8 i; + integer8 j; + integer8 k; integer8 rang_estime; + integer8 taille_matrice_f77; struct_complexe16 *c_work; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; - void *matrice_f77; rang(s_etat_processus, s_matrice, &rang_estime); @@ -87,7 +86,7 @@ inversion_matrice(struct_processus *s_et { case 'I' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -98,7 +97,7 @@ inversion_matrice(struct_processus *s_et { for(j = 0; j < (*s_matrice).nombre_lignes; j++) { - ((real8 *) matrice_f77)[k++] = ((integer8 **) + ((real8 *) matrice_f77)[k++] = (real8) ((integer8 **) (*s_matrice).tableau)[j][i]; } } @@ -110,8 +109,8 @@ inversion_matrice(struct_processus *s_et free((integer8 **) (*s_matrice).tableau); - if (((*s_matrice).tableau = (void **) malloc((*s_matrice) - .nombre_lignes * sizeof(real8 *))) == NULL) + if (((*s_matrice).tableau = malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -120,8 +119,8 @@ inversion_matrice(struct_processus *s_et for(i = 0; i < (*s_matrice).nombre_lignes; i++) { if ((((*s_matrice).tableau)[i] = - (real8 *) malloc((*s_matrice) - .nombre_colonnes * sizeof(real8))) == NULL) + (real8 *) malloc(((size_t) (*s_matrice) + .nombre_colonnes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -131,8 +130,8 @@ inversion_matrice(struct_processus *s_et (*s_matrice).type = 'R'; - if ((pivot = (integer4 *) malloc((*s_matrice).nombre_lignes * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -171,7 +170,8 @@ inversion_matrice(struct_processus *s_et free(work); - if ((work = (real8 *) malloc(dim_work * sizeof(real8))) == NULL) + if ((work = (real8 *) malloc(((size_t) dim_work) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -238,7 +238,7 @@ inversion_matrice(struct_processus *s_et case 'R' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -254,8 +254,8 @@ inversion_matrice(struct_processus *s_et } } - if ((pivot = (integer4 *) malloc((*s_matrice).nombre_lignes * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -294,7 +294,8 @@ inversion_matrice(struct_processus *s_et free(work); - if ((work = (real8 *) malloc(dim_work * sizeof(real8))) == NULL) + if ((work = (real8 *) malloc(((size_t) dim_work) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -361,7 +362,7 @@ inversion_matrice(struct_processus *s_et case 'C' : { - if ((matrice_f77 = (void *) malloc(taille_matrice_f77 * + if ((matrice_f77 = malloc(((size_t) taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -382,8 +383,8 @@ inversion_matrice(struct_processus *s_et } } - if ((pivot = (integer4 *) malloc((*s_matrice).nombre_lignes * - sizeof(integer4))) == NULL) + if ((pivot = (integer4 *) malloc(((size_t) (*s_matrice) + .nombre_lignes) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -423,7 +424,7 @@ inversion_matrice(struct_processus *s_et free(c_work); - if ((c_work = (struct_complexe16 *) malloc(dim_work * + if ((c_work = (struct_complexe16 *) malloc(((size_t) dim_work) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -535,6 +536,11 @@ valeurs_propres(struct_processus *s_etat integer4 lwork; integer4 erreur; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_f77; + struct_complexe16 *matrice_f77; struct_complexe16 *vpd_f77; struct_complexe16 *vpg_f77; @@ -544,11 +550,6 @@ valeurs_propres(struct_processus *s_etat unsigned char calcul_vp_gauches; unsigned char negatif; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; - taille_matrice_f77 = (*s_matrice).nombre_lignes * (*s_matrice).nombre_colonnes; dim_matrice = (integer4) (*s_matrice).nombre_lignes; @@ -557,8 +558,8 @@ valeurs_propres(struct_processus *s_etat * Allocation de la matrice complexe */ - if ((matrice_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((matrice_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -639,8 +640,8 @@ valeurs_propres(struct_processus *s_etat (*s_valeurs_propres).taille = (*s_matrice).nombre_lignes; if (((*s_valeurs_propres).tableau = (struct_complexe16 *) - malloc((*s_valeurs_propres).taille * sizeof(struct_complexe16))) - == NULL) + malloc(((size_t) (*s_valeurs_propres).taille) * + sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -651,8 +652,8 @@ valeurs_propres(struct_processus *s_etat (*s_vecteurs_propres_gauches).type = 'C'; calcul_vp_gauches = 'V'; - if ((vpg_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((vpg_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -669,8 +670,8 @@ valeurs_propres(struct_processus *s_etat (*s_vecteurs_propres_droits).type = 'C'; calcul_vp_droits = 'V'; - if ((vpd_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((vpd_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -685,7 +686,7 @@ valeurs_propres(struct_processus *s_etat negatif = 'N'; lwork = -1; - if ((rwork = (real8 *) malloc(2 * (*s_matrice).nombre_lignes * + if ((rwork = (real8 *) malloc(2 * ((size_t) (*s_matrice).nombre_lignes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -736,8 +737,8 @@ valeurs_propres(struct_processus *s_etat lwork = (integer4) work[0].partie_reelle; free(work); - if ((work = (struct_complexe16 *) malloc(lwork * sizeof(struct_complexe16))) - == NULL) + if ((work = (struct_complexe16 *) malloc(((size_t) lwork) * + sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -790,7 +791,7 @@ valeurs_propres(struct_processus *s_etat (*s_matrice).nombre_colonnes; if (((*s_vecteurs_propres_gauches).tableau = malloc( - (*s_vecteurs_propres_gauches).nombre_lignes * + ((size_t) (*s_vecteurs_propres_gauches).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -800,8 +801,8 @@ valeurs_propres(struct_processus *s_etat for(i = 0; i < (*s_vecteurs_propres_gauches).nombre_lignes; i++) { if ((((struct_complexe16 **) (*s_vecteurs_propres_gauches) - .tableau)[i] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_gauches).nombre_colonnes * + .tableau)[i] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -835,7 +836,7 @@ valeurs_propres(struct_processus *s_etat (*s_matrice).nombre_colonnes; if (((*s_vecteurs_propres_droits).tableau = malloc( - (*s_vecteurs_propres_droits).nombre_lignes * + ((size_t) (*s_vecteurs_propres_droits).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -845,8 +846,8 @@ valeurs_propres(struct_processus *s_etat for(i = 0; i < (*s_vecteurs_propres_droits).nombre_lignes; i++) { if ((((struct_complexe16 **) (*s_vecteurs_propres_droits) - .tableau)[i] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_droits).nombre_colonnes * + .tableau)[i] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -915,6 +916,11 @@ valeurs_propres_generalisees(struct_proc integer4 lwork; integer4 erreur; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_f77; + struct_complexe16 *alpha; struct_complexe16 *beta; struct_complexe16 *matrice_f77; @@ -927,11 +933,6 @@ valeurs_propres_generalisees(struct_proc unsigned char calcul_vp_gauches; unsigned char negatif; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_f77; - taille_matrice_f77 = (*s_matrice).nombre_lignes * (*s_matrice).nombre_colonnes; dim_matrice = (integer4) (*s_matrice).nombre_lignes; @@ -940,8 +941,8 @@ valeurs_propres_generalisees(struct_proc * Allocation de la matrice complexe */ - if ((matrice_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((matrice_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1022,8 +1023,8 @@ valeurs_propres_generalisees(struct_proc * Allocation de la metrique complexe */ - if ((metrique_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((metrique_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1104,8 +1105,8 @@ valeurs_propres_generalisees(struct_proc (*s_valeurs_propres).taille = (*s_matrice).nombre_lignes; if (((*s_valeurs_propres).tableau = (struct_complexe16 *) - malloc((*s_valeurs_propres).taille * sizeof(struct_complexe16))) - == NULL) + malloc(((size_t) (*s_valeurs_propres).taille) + * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1116,8 +1117,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_gauches).type = 'C'; calcul_vp_gauches = 'V'; - if ((vpg_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((vpg_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1134,8 +1135,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_droits).type = 'C'; calcul_vp_droits = 'V'; - if ((vpd_f77 = (struct_complexe16 *) malloc(taille_matrice_f77 * - sizeof(struct_complexe16))) == NULL) + if ((vpd_f77 = (struct_complexe16 *) malloc(((size_t) + taille_matrice_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1150,7 +1151,7 @@ valeurs_propres_generalisees(struct_proc negatif = 'N'; lwork = -1; - if ((rwork = (real8 *) malloc(8 * (*s_matrice).nombre_lignes * + if ((rwork = (real8 *) malloc(8 * ((size_t) (*s_matrice).nombre_lignes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1164,15 +1165,15 @@ valeurs_propres_generalisees(struct_proc return; } - if ((alpha = (struct_complexe16 *) malloc((*s_valeurs_propres).taille * - sizeof(struct_complexe16))) == NULL) + if ((alpha = (struct_complexe16 *) malloc(((size_t) (*s_valeurs_propres) + .taille) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((beta = (struct_complexe16 *) malloc((*s_valeurs_propres).taille * - sizeof(struct_complexe16))) == NULL) + if ((beta = (struct_complexe16 *) malloc(((size_t) (*s_valeurs_propres) + .taille) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1208,8 +1209,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_gauches).nombre_lignes = 1; (*s_vecteurs_propres_gauches).nombre_colonnes = 1; - if (((*s_vecteurs_propres_gauches).tableau = malloc( - (*s_vecteurs_propres_gauches).nombre_lignes * + if (((*s_vecteurs_propres_gauches).tableau = malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1217,8 +1218,8 @@ valeurs_propres_generalisees(struct_proc } if ((((struct_complexe16 **) (*s_vecteurs_propres_gauches) - .tableau)[0] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_gauches).nombre_colonnes * + .tableau)[0] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1234,8 +1235,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_droits).nombre_lignes = 1; (*s_vecteurs_propres_droits).nombre_colonnes = 1; - if (((*s_vecteurs_propres_droits).tableau = malloc( - (*s_vecteurs_propres_droits).nombre_lignes * + if (((*s_vecteurs_propres_droits).tableau = malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1243,8 +1244,8 @@ valeurs_propres_generalisees(struct_proc } if ((((struct_complexe16 **) (*s_vecteurs_propres_droits) - .tableau)[0] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_droits).nombre_colonnes * + .tableau)[0] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1258,8 +1259,8 @@ valeurs_propres_generalisees(struct_proc lwork = (integer4) work[0].partie_reelle; free(work); - if ((work = (struct_complexe16 *) malloc(lwork * sizeof(struct_complexe16))) - == NULL) + if ((work = (struct_complexe16 *) malloc(((size_t) lwork) * + sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1296,8 +1297,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_gauches).nombre_lignes = 1; (*s_vecteurs_propres_gauches).nombre_colonnes = 1; - if (((*s_vecteurs_propres_gauches).tableau = malloc( - (*s_vecteurs_propres_gauches).nombre_lignes * + if (((*s_vecteurs_propres_gauches).tableau = malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1305,8 +1306,8 @@ valeurs_propres_generalisees(struct_proc } if ((((struct_complexe16 **) (*s_vecteurs_propres_gauches) - .tableau)[0] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_gauches).nombre_colonnes * + .tableau)[0] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1322,8 +1323,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_droits).nombre_lignes = 1; (*s_vecteurs_propres_droits).nombre_colonnes = 1; - if (((*s_vecteurs_propres_droits).tableau = malloc( - (*s_vecteurs_propres_droits).nombre_lignes * + if (((*s_vecteurs_propres_droits).tableau = malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1331,8 +1332,8 @@ valeurs_propres_generalisees(struct_proc } if ((((struct_complexe16 **) (*s_vecteurs_propres_droits) - .tableau)[0] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_droits).nombre_colonnes * + .tableau)[0] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1375,8 +1376,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_gauches).nombre_colonnes = (*s_matrice).nombre_colonnes; - if (((*s_vecteurs_propres_gauches).tableau = malloc( - (*s_vecteurs_propres_gauches).nombre_lignes * + if (((*s_vecteurs_propres_gauches).tableau = malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1386,8 +1387,8 @@ valeurs_propres_generalisees(struct_proc for(i = 0; i < (*s_vecteurs_propres_gauches).nombre_lignes; i++) { if ((((struct_complexe16 **) (*s_vecteurs_propres_gauches) - .tableau)[i] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_gauches).nombre_colonnes * + .tableau)[i] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_gauches).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1420,8 +1421,8 @@ valeurs_propres_generalisees(struct_proc (*s_vecteurs_propres_droits).nombre_colonnes = (*s_matrice).nombre_colonnes; - if (((*s_vecteurs_propres_droits).tableau = malloc( - (*s_vecteurs_propres_droits).nombre_lignes * + if (((*s_vecteurs_propres_droits).tableau = malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1431,8 +1432,8 @@ valeurs_propres_generalisees(struct_proc for(i = 0; i < (*s_vecteurs_propres_droits).nombre_lignes; i++) { if ((((struct_complexe16 **) (*s_vecteurs_propres_droits) - .tableau)[i] = (struct_complexe16 *) malloc( - (*s_vecteurs_propres_droits).nombre_colonnes * + .tableau)[i] = (struct_complexe16 *) malloc(((size_t) + (*s_vecteurs_propres_droits).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1501,12 +1502,12 @@ moindres_carres(struct_processus *s_etat complex16 *cwork; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long taille_matrice_a_f77; - unsigned long taille_matrice_b_f77; - unsigned long taille_matrice_x_f77; + integer8 i; + integer8 j; + integer8 k; + integer8 taille_matrice_a_f77; + integer8 taille_matrice_b_f77; + integer8 taille_matrice_x_f77; void *matrice_a_f77; void *matrice_b_f77; @@ -1529,7 +1530,7 @@ moindres_carres(struct_processus *s_etat * Garniture de la matrice A */ - if ((matrice_a_f77 = (void *) malloc(taille_matrice_a_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_a_f77) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1542,7 +1543,7 @@ moindres_carres(struct_processus *s_etat { for(j = 0; j < (*s_matrice_a).nombre_lignes; j++) { - ((real8 *) matrice_a_f77)[k++] = ((integer8 **) + ((real8 *) matrice_a_f77)[k++] = (real8) ((integer8 **) (*s_matrice_a).tableau)[j][i]; } } @@ -1563,9 +1564,9 @@ moindres_carres(struct_processus *s_etat * Garniture de la matrice B */ - if ((matrice_b_f77 = (void *) malloc(((taille_matrice_b_f77 + if ((matrice_b_f77 = malloc(((size_t) ((taille_matrice_b_f77 < taille_matrice_x_f77) ? taille_matrice_x_f77 - : taille_matrice_b_f77) * sizeof(real8))) == NULL) + : taille_matrice_b_f77)) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1577,7 +1578,7 @@ moindres_carres(struct_processus *s_etat { for(j = 0; j < (*s_matrice_b).nombre_lignes; j++) { - ((real8 *) matrice_b_f77)[k++] = ((integer8 **) + ((real8 *) matrice_b_f77)[k++] = (real8) ((integer8 **) (*s_matrice_b).tableau)[j][i]; } @@ -1606,14 +1607,15 @@ moindres_carres(struct_processus *s_etat smlsiz = ilaenv_(®istre_1, "DGELSD", " ", ®istre_2, ®istre_2, ®istre_2, ®istre_2, 6, 1); - nlvl = 1 + ((integer4) log(((real8) (((*s_matrice_a).nombre_lignes < + nlvl = 1 + ((integer4) (log(((real8) (((*s_matrice_a).nombre_lignes < (*s_matrice_a).nombre_colonnes) ? (*s_matrice_a).nombre_lignes : (*s_matrice_a).nombre_colonnes)) / (smlsiz + 1)) / - log((real8) 2)); + log((real8) 2))); - if ((iwork = (integer4 *) malloc(((((*s_matrice_a).nombre_lignes < - (*s_matrice_a).nombre_colonnes) ? (*s_matrice_a).nombre_lignes - : (*s_matrice_a).nombre_colonnes) * (11 + (3 * nlvl))) * + if ((iwork = (integer4 *) malloc(((size_t) ((((*s_matrice_a) + .nombre_lignes < (*s_matrice_a).nombre_colonnes) + ? (*s_matrice_a).nombre_lignes + : (*s_matrice_a).nombre_colonnes) * (11 + (3 * nlvl)))) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1632,8 +1634,8 @@ moindres_carres(struct_processus *s_etat return; } - if ((vecteur_s = (real8 *) malloc(registre_5 * sizeof(real8))) - == NULL) + if ((vecteur_s = (real8 *) malloc(((size_t) registre_5) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1667,7 +1669,7 @@ moindres_carres(struct_processus *s_etat lwork = (integer4) work[0]; free(work); - if ((work = malloc(lwork * sizeof(real8))) == NULL) + if ((work = malloc(((size_t) lwork) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1704,8 +1706,8 @@ moindres_carres(struct_processus *s_etat (*s_matrice_x).nombre_lignes = (*s_matrice_a).nombre_colonnes; (*s_matrice_x).nombre_colonnes = (*s_matrice_b).nombre_colonnes; - if (((*s_matrice_x).tableau = malloc((*s_matrice_x).nombre_lignes * - sizeof(real8 *))) == NULL) + if (((*s_matrice_x).tableau = malloc(((size_t) (*s_matrice_x) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1714,7 +1716,7 @@ moindres_carres(struct_processus *s_etat for(j = 0; j < (*s_matrice_x).nombre_lignes; j++) { if ((((real8 **) (*s_matrice_x).tableau)[j] = (real8 *) - malloc((*s_matrice_x).nombre_colonnes * + malloc(((size_t) (*s_matrice_x).nombre_colonnes) * sizeof(real8)))== NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1745,7 +1747,7 @@ moindres_carres(struct_processus *s_etat * Garniture de la matrice A */ - if ((matrice_a_f77 = (void *) malloc(taille_matrice_a_f77 * + if ((matrice_a_f77 = malloc(((size_t) taille_matrice_a_f77) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1799,9 +1801,9 @@ moindres_carres(struct_processus *s_etat * Garniture de la matrice B */ - if ((matrice_b_f77 = (void *) malloc(((taille_matrice_b_f77 + if ((matrice_b_f77 = malloc(((size_t) ((taille_matrice_b_f77 < taille_matrice_x_f77) ? taille_matrice_x_f77 - : taille_matrice_b_f77) * sizeof(struct_complexe16))) == NULL) + : taille_matrice_b_f77)) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1864,10 +1866,10 @@ moindres_carres(struct_processus *s_etat smlsiz = ilaenv_(®istre_1, "ZGELSD", " ", ®istre_2, ®istre_2, ®istre_2, ®istre_2, 6, 1); - nlvl = 1 + ((integer4) log(((real8) (((*s_matrice_a).nombre_lignes < + nlvl = 1 + ((integer4) (log(((real8) (((*s_matrice_a).nombre_lignes < (*s_matrice_a).nombre_colonnes) ? (*s_matrice_a).nombre_lignes : (*s_matrice_a).nombre_colonnes)) / (smlsiz + 1)) - / log((real8) 2)); + / log((real8) 2))); if ((*s_matrice_a).nombre_lignes >= (*s_matrice_a).nombre_colonnes) { @@ -1880,15 +1882,17 @@ moindres_carres(struct_processus *s_etat smlsiz) + (8 * nlvl) + (*s_matrice_b).nombre_colonnes)); } - if ((rwork = (real8 *) malloc(lrwork * sizeof(real8))) == NULL) + if ((rwork = (real8 *) malloc(((size_t) lrwork) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; } - if ((iwork = (integer4 *) malloc(((((*s_matrice_a).nombre_lignes < - (*s_matrice_a).nombre_colonnes) ? (*s_matrice_a).nombre_lignes - : (*s_matrice_a).nombre_colonnes) * (11 + (3 * nlvl))) * + if ((iwork = (integer4 *) malloc(((size_t) ((((*s_matrice_a) + .nombre_lignes < (*s_matrice_a).nombre_colonnes) + ? (*s_matrice_a).nombre_lignes + : (*s_matrice_a).nombre_colonnes) * (11 + (3 * nlvl)))) * sizeof(integer4))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1907,8 +1911,8 @@ moindres_carres(struct_processus *s_etat return; } - if ((vecteur_s = (real8 *) malloc(registre_5 * sizeof(real8))) - == NULL) + if ((vecteur_s = (real8 *) malloc(((size_t) registre_5) * + sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1943,7 +1947,8 @@ moindres_carres(struct_processus *s_etat lwork = (integer4) cwork[0].partie_reelle; free(cwork); - if ((cwork = malloc(lwork * sizeof(struct_complexe16))) == NULL) + if ((cwork = malloc(((size_t) lwork) * sizeof(struct_complexe16))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1982,8 +1987,8 @@ moindres_carres(struct_processus *s_etat (*s_matrice_x).nombre_lignes = (*s_matrice_a).nombre_colonnes; (*s_matrice_x).nombre_colonnes = (*s_matrice_b).nombre_colonnes; - if (((*s_matrice_x).tableau = malloc((*s_matrice_x).nombre_lignes * - sizeof(struct_complexe16 *))) == NULL) + if (((*s_matrice_x).tableau = malloc(((size_t) (*s_matrice_x) + .nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1992,7 +1997,8 @@ moindres_carres(struct_processus *s_etat for(j = 0; j < (*s_matrice_x).nombre_lignes; j++) { if ((((struct_complexe16 **) (*s_matrice_x).tableau)[j] = - (struct_complexe16 *) malloc((*s_matrice_x).nombre_colonnes + (struct_complexe16 *) malloc(((size_t) + (*s_matrice_x).nombre_colonnes) * sizeof(struct_complexe16)))== NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;