rem
stringlengths
0
83.5k
add
stringlengths
0
223k
context
stringlengths
10
471k
meta
stringlengths
120
236
if (d < 0) err(zeropoler,"FpX_factor_2");
FpX_factor_2(GEN f, GEN p, long d){ GEN r, s, R, S; long v; int sgn; if (!d) return trivfact(); if (d == 1) return mkmat2(mkcol(f), mkvecsmall(1)); r = FpX_quad_root(f, p, 1); if (!r) return mkmat2(mkcol(f), mkvecsmall(1)); v = varn(f); s = otherroot(f, r, p); if (signe(r)) r = subii(p, r); if (signe(s)) s = subii(p, s); sgn = cmpii(s, r); if (sgn < 0) swap(s,r); R = deg1pol_i(gen_1, r, v); if (!sgn) return mkmat2(mkcol(R), mkvecsmall(2)); S = deg1pol_i(gen_1, s, v); return mkmat2(mkcol2(R,S), mkvecsmall2(1,1));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1beab53e2d29f6b096c6e9bbc382df32960cf164/polarit1.c/clean/src/basemath/polarit1.c
W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,q)),qold);
W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,qold)),qold);
rootpadiclift(GEN T, GEN S, GEN q, GEN Q){ ulong ltop=avma; long x; GEN qold; GEN W, Tr, Sr, Wr = gzero; int flag, init; x = varn(T); qold = q ; Tr = Fp_pol_red(T,q); W=Fp_poleval(deriv(Tr, x),S,q); W=mpinvmod(W,q); flag = 1; init = 0; while (flag) { q = sqri(q); if (cmpii(q,Q)>= 0) { flag = 0; q = Q; } Tr = Fp_pol_red(T,q); Sr = S; if (init) { W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,q)),qold); W = subii(gdeux,W); W = modii(mulii(Wr, W),qold); } else init = 1; Wr = W; S = subii(Sr, mulii(Wr, Fp_poleval(Tr, Sr,q))); S = modii(S,q); qold = q; } return gerepileupto(ltop,S);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/0b39351106a2738ec6008079a89dded1aa8d20cf/polarit1.c/buggy/src/basemath/polarit1.c
S = init_pow_q_mod_pT(X, q, u, T, p);
S = init_spec_FqXQ_pow(X, q, u, T, p);
FqX_split_by_degree(GEN *pz, GEN u, GEN q, GEN T, GEN p){ long nb = 0, d, dg, N = degpol(u); GEN v, S, g, X, z = cget1(N+1, t_VEC); *pz = z; if (N == 1) return 1; v = X = polx[varn(u)]; S = init_pow_q_mod_pT(X, q, u, T, p); appendL(z, S); for (d=1; d <= N>>1; d++) { v = spec_FqXQ_pow(v, S, T, p); g = FqX_gcd(gsub(v,X),u, T,p); dg = degpol(g); if (dg <= 0) continue; /* all factors of g have degree d */ add(z, g, dg / d); nb += dg / d; N -= dg; if (N) { u = FqX_div(u,g, T,p); v = FqX_rem(v,u, T,p); } } if (N) { add(z, u, 1); nb++; } return nb;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/0653bf4e80ffba66b9dad8b9b9bf38de88f14841/polarit1.c/clean/src/basemath/polarit1.c
setlg(E, nbfact); return sort_factor(mkvec2((GEN)t,E), cmpii);
setlg(E, nbfact); return sort_factor(mkmat2((GEN)t,E), cmpii);
FpX_factor_i(GEN f, GEN pp){ long e, N, nbfact, val, d = degpol(f); ulong p, k, j; GEN pps2, E, f2, p1, g1, u, *t; if (!d) return trivfact(); p = init_p(pp); /* to hold factors and exponents */ t = (GEN*)cgetg(d+1,t_COL); E = cgetg(d+1,t_VECSMALL); val = ZX_valuation(f, &f); e = nbfact = 1; if (val) { t[1] = polx[varn(f)]; E[1] = val; nbfact++; } pps2 = shifti(pp,-1); for(;;) { f2 = FpX_gcd(f,derivpol(f), pp); g1 = lg(f2)==3? f: FpX_div(f,f2,pp); k = 0; while (lg(g1)>3) { k++; if (p && !(k%p)) { k++; f2 = FpX_div(f2,g1,pp); } p1 = FpX_gcd(f2,g1, pp); u = g1; g1 = p1; if (degpol(p1)) { u = FpX_div( u,p1,pp); f2= FpX_div(f2,p1,pp); } /* u is square-free (product of irred. of multiplicity e * k) */ N = degpol(u); if (N > 0) { t[nbfact] = FpX_normalize(u,pp); d = (N==1)? 1: FpX_split_Berlekamp(t+nbfact, pp); for (j=0; j<(ulong)d; j++) E[nbfact+j] = e*k; nbfact += d; } } if (!p) break; j = degpol(f2); if (!j) break; if (j % p) err(talker, "factmod: %lu is not prime", p); e *= p; f = poldeflate_i(f2, p); } setlg(t, nbfact); setlg(E, nbfact); return sort_factor(mkvec2((GEN)t,E), cmpii);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/0653bf4e80ffba66b9dad8b9b9bf38de88f14841/polarit1.c/clean/src/basemath/polarit1.c
char new_name[ NAME_MAX + 1 ];
char new_name[ IMFS_NAME_MAX + 1 ];
int IMFS_mknod( const char *token, /* IN */ mode_t mode, /* IN */ dev_t dev, /* IN */ rtems_filesystem_location_info_t *pathloc /* IN/OUT */){ IMFS_token_types type = 0; IMFS_jnode_t *new_node; int result; char new_name[ NAME_MAX + 1 ]; IMFS_types_union info; IMFS_get_token( token, new_name, &result ); /* * Figure out what type of IMFS node this is. */ if ( S_ISDIR(mode) ) type = IMFS_DIRECTORY; else if ( S_ISREG(mode) ) type = IMFS_MEMORY_FILE; else if ( S_ISBLK(mode) || S_ISCHR(mode) ) { type = IMFS_DEVICE; rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor ); } else { assert( 0 ); set_errno_and_return_minus_one( EINVAL ); } /* * Allocate and fill in an IMFS jnode */ new_node = IMFS_create_node( pathloc, type, new_name, mode, &info ); if ( !new_node ) set_errno_and_return_minus_one( ENOMEM ); return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3cf8394af5f646642df593c8de833441e186af64/imfs_mknod.c/buggy/c/src/exec/libfs/src/imfs/imfs_mknod.c
long e, d, m, i, lx; GEN y;
floorr(GEN x){ if (signe(x) >= 0) return truncr(x); if ((e=expo(x)) < 0) return stoi(-1); d = (e>>TWOPOTBITS_IN_LONG) + 3; m = e & (BITS_IN_LONG-1); lx=lg(x); if (d>lx) err(precer, "floorr (precision loss in truncation)"); y = cgeti(d+1); if (++m == BITS_IN_LONG) { for (i=2; i<d; i++) y[d-i+1]=x[i]; i=d; while (i<lx && !x[i]) i++; if (i==lx) goto END; } else { GEN z=cgeti(d); for (i=2; i<d; i++) z[d-i+1]=x[i]; mpn_rshift(LIMBS(y),LIMBS(z),d-2,BITS_IN_LONG-m); if (x[d-1]<<m == 0) { i=d; while (i<lx && !x[i]) i++; if (i==lx) goto END; } } if (mpn_add_1(LIMBS(y),LIMBS(y),d-2,1)) y[d++]=1; END: y[1] = evalsigne(-1) | evallgefint(d); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/fcc5384a220934656ec9fd7be72c59951238305e/mp.c/buggy/src/kernel/gmp/mp.c
errno = ENOSYS; return -1;
rtems_libio_t *iop; /* * Get the file control block structure associated with the file descriptor */ iop = rtems_libio_iop( dirp->dd_fd ); if (iop == NULL) assert(0); return (long)( iop->offset );
long telldir( DIR *dirp){ errno = ENOSYS; return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/07a3253de2c3f9bc2d96a351680ec72548dadd2d/telldir.c/buggy/c/src/lib/libc/telldir.c
int rval; XlatRec l; l.aspace = as; l.address = aIn; l.reverse = reverse; /* map result -1/0/1 to -2/-1/0 with 0 on success */ rval = mapOverAll(master,xlatePort,(void*)&l) - 1; *paOut = l.address; return rval;
DFLT_BASE; return vmeUniverseXlateAddrXX(base, master, reverse, as, aIn, paOut);
vmeUniverseXlateAddr( int master, /* look in the master windows */ int reverse, /* reverse mapping; for masters: map local to VME */ unsigned long as, /* address space */ unsigned long aIn, /* address to look up */ unsigned long *paOut/* where to put result */ ){int rval;XlatRec l; l.aspace = as; l.address = aIn; l.reverse = reverse; /* map result -1/0/1 to -2/-1/0 with 0 on success */ rval = mapOverAll(master,xlatePort,(void*)&l) - 1; *paOut = l.address; return rval;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c
signal_set = asr->signals_posted; if ( signal_set ) { /* if ( _ASR_Are_signals_pending( asr ) ) { signal_set = asr->signals_posted; */ asr->signals_posted = 0; _ISR_Enable( level ); asr->nest_level += 1; rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); (*asr->handler)( signal_set ); asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); } else _ISR_Enable( level );
asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
User_extensions_routine _RTEMS_tasks_Switch_extension( Thread_Control *executing){ ISR_Level level; RTEMS_API_Control *api; ASR_Information *asr; rtems_signal_set signal_set; Modes_Control prev_mode; api = executing->API_Extensions[ THREAD_API_RTEMS ]; asr = &api->Signal; _ISR_Disable( level ); signal_set = asr->signals_posted; if ( signal_set ) { /* if ( _ASR_Are_signals_pending( asr ) ) { signal_set = asr->signals_posted; */ asr->signals_posted = 0; _ISR_Enable( level ); asr->nest_level += 1; rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); (*asr->handler)( signal_set ); asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); } else _ISR_Enable( level );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3652ad356bf13abe0963c992cbbda96476d31609/tasks.c/clean/c/src/exec/rtems/src/tasks.c
rk -= lg((GEN)herm[1]); /* two steps: bug in pgcc 1.1.3 inlining IS */
rk -= lg((GEN)herm[1]); /* two steps: bug in pgcc 1.1.3 inlining (IS) */
ComputeKernel0(GEN P, GEN DA, GEN DB, long nbA, long nbB){ long rk, av = avma; GEN herm, mask1, mask2, U; herm = hnfall(concatsp(P, DB)); rk = nbA + nbB + 1; rk -= lg((GEN)herm[1]); /* two steps: bug in pgcc 1.1.3 inlining IS */ mask1 = subis(shifti(gun, nbA), 1); mask2 = subis(shifti(gun, rk), 1); U = matextract((GEN)herm[2], mask1, mask2); if (!gcmp0(DA)) U = concatsp(U, DA); return gerepileupto(av, hnf(U));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8467102a6a27beaf59536b306453c962bd7c55b2/stark.c/clean/src/modules/stark.c
GEN z = gmael(L,1,1); /* [bid,U] */
GEN z = gel(L,1); if (typ(z) != t_VEC) err(typeer, s); if (lg(z) == 1) return; z = gel(L,1); /* [bid,U] */
chk_listBU(GEN L, char *s) { if (typ(L) != t_VEC) err(typeer,s); if (lg(L) > 1) { GEN z = gmael(L,1,1); /* [bid,U] */ if (typ(z) != t_VEC || lg(z) != 3) err(typeer, s); checkbid(gel(z,1)); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/cce7d33d7e8a5639b6ac6b03de02d005b1ce3fdc/buch3.c/clean/src/basemath/buch3.c
rtems_unsigned32 t;
uint32_t t;
int Read_timer( void ){ rtems_unsigned32 t; unsigned long long total; t = MC9328MXL_TMR2_TCN; /* * Total is calculated by taking into account the number of timer overflow * interrupts since the timer was initialized and clicks since the last * interrupts. */ total = (t - g_start); /* convert to nanoseconds */ total = (total * 1000)/ g_freq; if ( Timer_driver_Find_average_overhead == 1 ) { return (int) total; } else if ( total < LEAST_VALID ) { return 0; } /* * Somehow convert total into microseconds */ return (total - AVG_OVERHEAD);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/15ebe58b4ead4a088120590b80700bc152416cb9/timer.c/clean/c/src/lib/libcpu/arm/mc9328mxl/timer/timer.c
int lfa, i, j;
long lfa, i, j;
e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c
d *= u_pow(P[j], m % E[j]);
d *= npownn(P[j], m % E[j]);
e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c
s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d)));
s = muliu(s, (ulong)npownn(d, 1 + u_lval(t,d)));
e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c
GEN liste = gel(bid,4), arch = gmael(bid,1,2); return F2V_red_ip(gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch))));
GEN U, liste = gel(bid,4), arch = gmael(bid,1,2); long i; U = gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch))); for (i = 1; i < lg(U); i++) F2V_red_ip(gel(U,i)); return U;
zlog_unitsarch(GEN sgnU, GEN bid){ GEN liste = gel(bid,4), arch = gmael(bid,1,2); return F2V_red_ip(gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch))));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a1492eb1f9a7a31e99dc16dab3f6a29df8a9b9f0/base3.c/buggy/src/basemath/base3.c
long lx,i, tx=typ(x); GEN p1,p2,y;
long lx, i, tx=typ(x); GEN p1, y;
gnorm(GEN x){ pari_sp av; long lx,i, tx=typ(x); GEN p1,p2,y; switch(tx) { case t_INT: return sqri(x); case t_REAL: return mulrr(x,x); case t_FRAC: return gsqr(x); case t_COMPLEX: av = avma; return gerepileupto(av, gadd(gsqr((GEN)x[1]), gsqr((GEN)x[2]))); case t_QUAD: av = avma; p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2)); case t_POL: case t_SER: case t_RFRAC: av = avma; return gerepileupto(av, greal(gmul(gconj(x),x))); case t_POLMOD: { GEN T = (GEN)x[1], A = (GEN)x[2]; if (typ(A) != t_POL) return gpowgs(A, degpol(T)); y = subres(T, A); p1 = leading_term(T); if (gcmp1(p1) || gcmp0(A)) return y; av = avma; T = gpowgs(p1, degpol(A)); return gerepileupto(av, gdiv(y,T)); } case t_VEC: case t_COL: case t_MAT: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=lnorm((GEN) x[i]); return y; } err(typeer,"gnorm"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/alglin2.c/buggy/src/basemath/alglin2.c
p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2));
{ GEN u = (GEN)x[3], v = (GEN)x[2]; GEN X = (GEN)x[1], b = (GEN)X[3], c = (GEN)X[2]; p1 = gcmp0(b)? gsqr(v): gmul(v, gadd(u,v)); return gerepileupto(av, gadd(p1, gmul(c, gsqr(u)))); }
gnorm(GEN x){ pari_sp av; long lx,i, tx=typ(x); GEN p1,p2,y; switch(tx) { case t_INT: return sqri(x); case t_REAL: return mulrr(x,x); case t_FRAC: return gsqr(x); case t_COMPLEX: av = avma; return gerepileupto(av, gadd(gsqr((GEN)x[1]), gsqr((GEN)x[2]))); case t_QUAD: av = avma; p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2)); case t_POL: case t_SER: case t_RFRAC: av = avma; return gerepileupto(av, greal(gmul(gconj(x),x))); case t_POLMOD: { GEN T = (GEN)x[1], A = (GEN)x[2]; if (typ(A) != t_POL) return gpowgs(A, degpol(T)); y = subres(T, A); p1 = leading_term(T); if (gcmp1(p1) || gcmp0(A)) return y; av = avma; T = gpowgs(p1, degpol(A)); return gerepileupto(av, gdiv(y,T)); } case t_VEC: case t_COL: case t_MAT: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=lnorm((GEN) x[i]); return y; } err(typeer,"gnorm"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/alglin2.c/buggy/src/basemath/alglin2.c
mymyrand()
mymyrand(void)
mymyrand(){#if BITS_IN_RANDOM == 64 pari_randseed = (1000000000000654397*pari_randseed + 12347) & ~HIGHBIT;#else pari_randseed = (1000276549*pari_randseed + 12347) & 0x7fffffff;#endif return pari_randseed;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/f2f2301afec60d0e7c87f92091753974f8c8d11c/bibli2.c/buggy/src/basemath/bibli2.c
norme1 = (GEN)norms[ per[i-1] ];
smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; int stockall = (stockmax < 0); if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); av = avma; lim = stack_lim(av,2); if (stockall) stockmax = 200; if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { GEN dummy = cgetg(1, t_STR); int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) S = clonefill(S, s, stockmax); if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1 = avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { /* overflow */ GEN per, Sold = S; pari_sp av2; if (!check) goto END; if (stockall) { stockmax *= 2; S = cgetg(stockmax+1, t_VEC); } av2 = avma; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)Sold[k])) { if (!j) borne1 = mpadd(norme1,eps); S[++j] = Sold[k]; } } s = j; avma = av2; if (s) { if (isclone(Sold)) { S = clonefill(S, s, stockmax); gunclone(Sold); } norme1 = (GEN)norms[ per[i-1] ]; norms = cgetg(stockmax+1, t_VEC); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); checkcnt = 0; } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2994c019c9bb3d9be3a3e4c974071d4caddf4f7e/bibli1.c/buggy/src/basemath/bibli1.c
const unsigned32 *base, *ebase; unsigned32 length;
const uint32_t *base, *ebase; uint32_t length;
void *Stack_check_find_high_water_mark( const void *s, size_t n){ const unsigned32 *base, *ebase; unsigned32 length; base = s; length = n/4;#if ( CPU_STACK_GROWS_UP == TRUE ) /* * start at higher memory and find first word that does not * match pattern */ base += length - 1; for (ebase = s; base > ebase; base--) if (*base != U32_PATTERN) return (void *) base;#else /* * start at lower memory and find first word that does not * match pattern */ base += PATTERN_SIZE_WORDS; for (ebase = base + length; base < ebase; base++) if (*base != U32_PATTERN) return (void *) base;#endif return (void *)0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 size, used;
uint32_t size, used;
void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 u32_name;
uint32_t u32_name;
void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
u32_name = (unsigned32)the_thread->Object.name;
u32_name = (uint32_t )the_thread->Object.name;
void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
(unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1,
(uint32_t ) stack->area, (uint32_t ) stack->area + (uint32_t ) stack->size - 1,
void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 length = 0;
uint32_t length = 0;
rtems_monitor_queue_dump( rtems_monitor_queue_t *monitor_queue, boolean verbose){ unsigned32 length = 0; length += rtems_monitor_dump_id(monitor_queue->id); length += rtems_monitor_pad(11, length); length += rtems_monitor_dump_name(monitor_queue->name); length += rtems_monitor_pad(19, length); length += rtems_monitor_dump_attributes(monitor_queue->attributes); length += rtems_monitor_pad(31, length); length += rtems_monitor_dump_decimal(monitor_queue->number_of_pending_messages); length += rtems_monitor_pad(39, length); length += rtems_monitor_dump_decimal(monitor_queue->maximum_pending_messages); length += rtems_monitor_pad(48, length); length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size); printf("\n");}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-queue.c/clean/cpukit/libmisc/monitor/mon-queue.c
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1)
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1, GEN p)
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base2.c/clean/src/basemath/base2.c
gpmem_t av=avma,tetpil;
gpmem_t av=avma;
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base2.c/clean/src/basemath/base2.c
res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));
res = project(algebre,res,k,kbar,p); return gerepileupto(av, FpV_red(gmul(algebre1,res), p));
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base2.c/clean/src/basemath/base2.c
}
rtems_monitor_task( rtems_task_argument monitor_flags){ rtems_tcb *debugee = 0; rtems_context *rp; rtems_context_fp *fp; char command_buffer[513]; int argc; char *argv[64]; boolean verbose = FALSE; if (monitor_flags & RTEMS_MONITOR_SUSPEND) (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); for (;;) { extern rtems_tcb * _Thread_Executing; rtems_monitor_command_entry_t *command; debugee = _Thread_Executing; rp = &debugee->Registers; fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ if (0 == rtems_monitor_command_read(command_buffer, &argc, argv)) continue; if ((command = rtems_monitor_command_lookup(rtems_monitor_commands, argc, argv)) == 0) continue; command->command_function(argc, argv, command->command_arg, verbose); fflush(stdout); }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/32e2554f105163017052572a1830f3caa19ba625/mon-monitor.c/buggy/cpukit/libmisc/monitor/mon-monitor.c
rtems_unsigned32 n = rtems_get_index(*next_id);
uint32_t n = rtems_get_index(*next_id);
rtems_monitor_symbol_next( void *object_info, rtems_monitor_symbol_t *canonical, rtems_id *next_id){ rtems_symbol_table_t *table; rtems_unsigned32 n = rtems_get_index(*next_id); table = *(rtems_symbol_table_t **) object_info; if (table == 0) goto failed; if (n >= table->next) goto failed; /* NOTE: symbols do not have id and name fields */ if (table->sorted == 0) rtems_symbol_sort(table); _Thread_Disable_dispatch(); *next_id += 1; return (void *) (table->addresses + n);failed: *next_id = RTEMS_OBJECT_ID_FINAL; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-symbols.c/clean/cpukit/libmisc/monitor/mon-symbols.c
unsigned32 default_node,
uint32_t default_node,
rtems_monitor_id_fixup( rtems_id id, unsigned32 default_node, rtems_monitor_object_type_t type){ unsigned32 node; node = rtems_get_node(id); if (node == 0) { if (rtems_get_class(id) != OBJECTS_NO_CLASS) type = rtems_get_class(id); id = _Objects_Build_id( OBJECTS_CLASSIC_API, type, default_node, rtems_get_index(id)); } return id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-object.c/clean/cpukit/libmisc/monitor/mon-object.c
unsigned32 node;
uint32_t node;
rtems_monitor_id_fixup( rtems_id id, unsigned32 default_node, rtems_monitor_object_type_t type){ unsigned32 node; node = rtems_get_node(id); if (node == 0) { if (rtems_get_class(id) != OBJECTS_NO_CLASS) type = rtems_get_class(id); id = _Objects_Build_id( OBJECTS_CLASSIC_API, type, default_node, rtems_get_index(id)); } return id;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-object.c/clean/cpukit/libmisc/monitor/mon-object.c
if (resid < 0 || so->so_type == SOCK_STREAM && (flags & MSG_EOR)) {
if ((resid < 0) || (so->so_type == SOCK_STREAM && (flags & MSG_EOR))) {
sosend(so, addr, uio, top, control, flags) register struct socket *so; struct mbuf *addr; struct uio *uio; struct mbuf *top; struct mbuf *control; int flags;{ struct mbuf **mp; register struct mbuf *m; register long space, len, resid; int clen = 0, error, s, dontroute, mlen; int atomic = sosendallatonce(so) || top; if (uio) resid = uio->uio_resid; else resid = top->m_pkthdr.len; /* * In theory resid should be unsigned. * However, space must be signed, as it might be less than 0 * if we over-committed, and we must use a signed comparison * of space and resid. On the other hand, a negative resid * causes us to loop sending 0-length segments to the protocol. * * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM * type sockets since that's an error. */ if (resid < 0 || so->so_type == SOCK_STREAM && (flags & MSG_EOR)) { error = EINVAL; goto out; } dontroute = (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && (so->so_proto->pr_flags & PR_ATOMIC); if (control) clen = control->m_len;#define snderr(errno) { error = errno; splx(s); goto release; }restart: error = sblock(&so->so_snd, SBLOCKWAIT(flags)); if (error) goto out; do { s = splnet(); if (so->so_state & SS_CANTSENDMORE) snderr(EPIPE); if (so->so_error) { error = so->so_error; so->so_error = 0; splx(s); goto release; } if ((so->so_state & SS_ISCONNECTED) == 0) { /* * `sendto' and `sendmsg' is allowed on a connection- * based socket if it supports implied connect. * Return ENOTCONN if not connected and no address is * supplied. */ if ((so->so_proto->pr_flags & PR_CONNREQUIRED) && (so->so_proto->pr_flags & PR_IMPLOPCL) == 0) { if ((so->so_state & SS_ISCONFIRMING) == 0 && !(resid == 0 && clen != 0)) snderr(ENOTCONN); } else if (addr == 0) snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ? ENOTCONN : EDESTADDRREQ); } space = sbspace(&so->so_snd); if (flags & MSG_OOB) space += 1024; if ((atomic && resid > so->so_snd.sb_hiwat) || clen > so->so_snd.sb_hiwat) snderr(EMSGSIZE); if (space < resid + clen && uio && (atomic || space < so->so_snd.sb_lowat || space < clen)) { if (so->so_state & SS_NBIO) snderr(EWOULDBLOCK); sbunlock(&so->so_snd); error = sbwait(&so->so_snd); splx(s); if (error) goto out; goto restart; } splx(s); mp = &top; space -= clen; do { if (uio == NULL) { /* * Data is prepackaged in "top". */ resid = 0; if (flags & MSG_EOR) top->m_flags |= M_EOR; } else do { if (top == 0) { MGETHDR(m, M_WAIT, MT_DATA); mlen = MHLEN; m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = (struct ifnet *)0; } else { MGET(m, M_WAIT, MT_DATA); mlen = MLEN; } if (resid >= MINCLSIZE) { MCLGET(m, M_WAIT); if ((m->m_flags & M_EXT) == 0) goto nopages; mlen = MCLBYTES; len = min(min(mlen, resid), space); } else {nopages: len = min(min(mlen, resid), space); /* * For datagram protocols, leave room * for protocol headers in first mbuf. */ if (atomic && top == 0 && len < mlen) MH_ALIGN(m, len); } space -= len; error = uiomove(mtod(m, caddr_t), (int)len, uio); resid = uio->uio_resid; m->m_len = len; *mp = m; top->m_pkthdr.len += len; if (error) goto release; mp = &m->m_next; if (resid <= 0) { if (flags & MSG_EOR) top->m_flags |= M_EOR; break; } } while (space > 0 && atomic); if (dontroute) so->so_options |= SO_DONTROUTE; s = splnet(); /* XXX */ error = (*so->so_proto->pr_usrreqs->pru_send)(so, (flags & MSG_OOB) ? PRUS_OOB : /* * If the user set MSG_EOF, the protocol * understands this flag and nothing left to * send then use PRU_SEND_EOF instead of PRU_SEND. */ ((flags & MSG_EOF) && (so->so_proto->pr_flags & PR_IMPLOPCL) && (resid <= 0)) ? PRUS_EOF : 0, top, addr, control); splx(s); if (dontroute) so->so_options &= ~SO_DONTROUTE; clen = 0; control = 0; top = 0; mp = &top; if (error) goto release; } while (resid && space > 0); } while (resid);release: sbunlock(&so->so_snd);out: if (top) m_freem(top); if (control) m_freem(control); return (error);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/uipc_socket.c/clean/c/src/lib/libnetworking/kern/uipc_socket.c
char new_name[ NAME_MAX + 1 ];
char new_name[ IMFS_NAME_MAX + 1 ];
int IMFS_mknod( const char *token, /* IN */ mode_t mode, /* IN */ dev_t dev, /* IN */ rtems_filesystem_location_info_t *pathloc /* IN/OUT */){ IMFS_token_types type = 0; IMFS_jnode_t *new_node; int result; char new_name[ NAME_MAX + 1 ]; IMFS_types_union info; IMFS_get_token( token, new_name, &result ); /* * Figure out what type of IMFS node this is. */ if ( S_ISDIR(mode) ) type = IMFS_DIRECTORY; else if ( S_ISREG(mode) ) type = IMFS_MEMORY_FILE; else if ( S_ISBLK(mode) || S_ISCHR(mode) ) { type = IMFS_DEVICE; rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor ); } else { assert( 0 ); set_errno_and_return_minus_one( EINVAL ); } /* * Allocate and fill in an IMFS jnode */ new_node = IMFS_create_node( pathloc, type, new_name, mode, &info ); if ( !new_node ) set_errno_and_return_minus_one( ENOMEM ); return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3cf8394af5f646642df593c8de833441e186af64/imfs_mknod.c/buggy/cpukit/libfs/src/imfs/imfs_mknod.c
term_width_intern()
term_width_intern(void)
term_width_intern(){#ifdef HAS_TIOCGWINSZ { struct winsize s; if (!under_emacs && !under_texmacs && !ioctl(0, TIOCGWINSZ, &s)) return s.ws_col; }#endif#ifdef UNIX { char *str; if ((str = getenv("COLUMNS"))) return atoi(str); }#endif#ifdef __EMX__ { int scrsize[2]; _scrsize(scrsize); return scrsize[0]; }#endif return 0;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/es.c/clean/src/language/es.c
&& ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
static int rtems_tftp_open_worker( rtems_libio_t *iop, char *full_path_name, unsigned32 flags, unsigned32 mode){ struct tftpStream *tp; int retryCount; struct in_addr farAddress; int s; int len; char *cp1; char *cp2; char *remoteFilename; rtems_interval now; rtems_status_code sc; char *hostname; /* * Extract the host name component */ cp2 = full_path_name; while (*cp2 == '/') cp2++; hostname = cp2; while (*cp2 != '/') { if (*cp2 == '\0') return ENOENT; cp2++; } *cp2++ = '\0'; /* * Convert hostname to Internet address */ if (strcmp (hostname, "BOOTP_HOST") == 0) farAddress = rtems_bsdnet_bootp_server_address; else farAddress.s_addr = inet_addr (hostname); if ((farAddress.s_addr == 0) || (farAddress.s_addr == ~0)) return ENOENT; /* * Extract file pathname component */ while (*cp2 == '/') cp2++; if (strcmp (cp2, "BOOTP_FILE") == 0) { cp2 = rtems_bsdnet_bootp_boot_file_name; while (*cp2 == '/') cp2++; } if (*cp2 == '\0') return ENOENT; remoteFilename = cp2; if (strlen (remoteFilename) > (TFTP_BUFSIZE - 10)) return ENOENT; /* * Find a free stream */ sc = rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) return EBUSY; for (s = 0 ; s < nStreams ; s++) { if (tftpStreams[s] == NULL) break; } if (s == nStreams) { /* * Reallocate stream pointers * Guard against the case where realloc() returns NULL. */ struct tftpStream **np; np = realloc (tftpStreams, ++nStreams * sizeof *tftpStreams); if (np == NULL) { rtems_semaphore_release (tftp_mutex); return ENOMEM; } tftpStreams = np; } tp = tftpStreams[s] = malloc (sizeof (struct tftpStream)); rtems_semaphore_release (tftp_mutex); if (tp == NULL) return ENOMEM; iop->data0 = s; iop->data1 = tp; /* * Create the socket */ if ((tp->socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { releaseStream (s); return ENOMEM; } /* * Bind the socket to a local address */ retryCount = 0; rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); for (;;) { int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); releaseStream (s); return EBUSY; } } /* * Set the UDP destination to the TFTP server * port on the remote machine. */ tp->farAddress.sin_family = AF_INET; tp->farAddress.sin_addr = farAddress; tp->farAddress.sin_port = htons (69); /* * Start the transfer */ tp->firstReply = 1; retryCount = 0; for (;;) { /* * Create the request */ if ((flags & O_ACCMODE) == O_RDONLY) { tp->writing = 0; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); } else { tp->writing = 1; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_WRQ); } cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') continue; cp2 = "octet"; while ((*cp1++ = *cp2++) != '\0') continue; len = cp1 - (char *)&tp->pkbuf.tftpRWRQ; /* * Send the request */ if (sendto (tp->socket, (char *)&tp->pkbuf, len, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); releaseStream (s); return EIO; } /* * Get reply */ len = getPacket (tp, retryCount); if (len >= (int) sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); if (!tp->writing && (opcode == TFTP_OPCODE_DATA) && (ntohs (tp->pkbuf.tftpDATA.blocknum) == 1)) { tp->nused = 0; tp->blocknum = 1; tp->nleft = len - 2 * sizeof (rtems_unsigned16); tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); releaseStream (s); return EIO; } break; } if (tp->writing && (opcode == TFTP_OPCODE_ACK) && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) { tp->nused = 0; tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum); break; } if (opcode == TFTP_OPCODE_ERROR) { int e = tftpErrno (tp); close (tp->socket); releaseStream (s); return e; } } /* * Keep trying */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); releaseStream (s); return EIO; } } return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/cf42e73556a02b6789ca6c6f6aa058ac7f25b6b5/tftpDriver.c/buggy/c/src/libnetworking/lib/tftpDriver.c
tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
tp->blocknum = 1;
static int rtems_tftp_open_worker( rtems_libio_t *iop, char *full_path_name, unsigned32 flags, unsigned32 mode){ struct tftpStream *tp; int retryCount; struct in_addr farAddress; int s; int len; char *cp1; char *cp2; char *remoteFilename; rtems_interval now; rtems_status_code sc; char *hostname; /* * Extract the host name component */ cp2 = full_path_name; while (*cp2 == '/') cp2++; hostname = cp2; while (*cp2 != '/') { if (*cp2 == '\0') return ENOENT; cp2++; } *cp2++ = '\0'; /* * Convert hostname to Internet address */ if (strcmp (hostname, "BOOTP_HOST") == 0) farAddress = rtems_bsdnet_bootp_server_address; else farAddress.s_addr = inet_addr (hostname); if ((farAddress.s_addr == 0) || (farAddress.s_addr == ~0)) return ENOENT; /* * Extract file pathname component */ while (*cp2 == '/') cp2++; if (strcmp (cp2, "BOOTP_FILE") == 0) { cp2 = rtems_bsdnet_bootp_boot_file_name; while (*cp2 == '/') cp2++; } if (*cp2 == '\0') return ENOENT; remoteFilename = cp2; if (strlen (remoteFilename) > (TFTP_BUFSIZE - 10)) return ENOENT; /* * Find a free stream */ sc = rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) return EBUSY; for (s = 0 ; s < nStreams ; s++) { if (tftpStreams[s] == NULL) break; } if (s == nStreams) { /* * Reallocate stream pointers * Guard against the case where realloc() returns NULL. */ struct tftpStream **np; np = realloc (tftpStreams, ++nStreams * sizeof *tftpStreams); if (np == NULL) { rtems_semaphore_release (tftp_mutex); return ENOMEM; } tftpStreams = np; } tp = tftpStreams[s] = malloc (sizeof (struct tftpStream)); rtems_semaphore_release (tftp_mutex); if (tp == NULL) return ENOMEM; iop->data0 = s; iop->data1 = tp; /* * Create the socket */ if ((tp->socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { releaseStream (s); return ENOMEM; } /* * Bind the socket to a local address */ retryCount = 0; rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); for (;;) { int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); releaseStream (s); return EBUSY; } } /* * Set the UDP destination to the TFTP server * port on the remote machine. */ tp->farAddress.sin_family = AF_INET; tp->farAddress.sin_addr = farAddress; tp->farAddress.sin_port = htons (69); /* * Start the transfer */ tp->firstReply = 1; retryCount = 0; for (;;) { /* * Create the request */ if ((flags & O_ACCMODE) == O_RDONLY) { tp->writing = 0; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); } else { tp->writing = 1; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_WRQ); } cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') continue; cp2 = "octet"; while ((*cp1++ = *cp2++) != '\0') continue; len = cp1 - (char *)&tp->pkbuf.tftpRWRQ; /* * Send the request */ if (sendto (tp->socket, (char *)&tp->pkbuf, len, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); releaseStream (s); return EIO; } /* * Get reply */ len = getPacket (tp, retryCount); if (len >= (int) sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); if (!tp->writing && (opcode == TFTP_OPCODE_DATA) && (ntohs (tp->pkbuf.tftpDATA.blocknum) == 1)) { tp->nused = 0; tp->blocknum = 1; tp->nleft = len - 2 * sizeof (rtems_unsigned16); tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); releaseStream (s); return EIO; } break; } if (tp->writing && (opcode == TFTP_OPCODE_ACK) && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) { tp->nused = 0; tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum); break; } if (opcode == TFTP_OPCODE_ERROR) { int e = tftpErrno (tp); close (tp->socket); releaseStream (s); return e; } } /* * Keep trying */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); releaseStream (s); return EIO; } } return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/cf42e73556a02b6789ca6c6f6aa058ac7f25b6b5/tftpDriver.c/buggy/c/src/libnetworking/lib/tftpDriver.c
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
static int rtems_tftp_flush ( struct tftpStream *tp ){ int wlen, rlen; int retryCount = 0; wlen = tp->nused + 2 * sizeof (rtems_unsigned16); for (;;) { tp->pkbuf.tftpDATA.opcode = htons (TFTP_OPCODE_DATA); tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);#ifdef RTEMS_TFTP_DRIVER_DEBUG if (rtems_tftp_driver_debug) printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);#endif if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) return EIO; rlen = getPacket (tp, retryCount); /* * Our last packet won't necessarily be acknowledged! */ if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data)) return 0; if (rlen >= (int)sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpACK.opcode); if ((opcode == TFTP_OPCODE_ACK) && (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) { tp->nused = 0; tp->blocknum++; return 0; } if (opcode == TFTP_OPCODE_ERROR) return tftpErrno (tp); } /* * Keep trying? */ if (++retryCount == IO_RETRY_LIMIT) return EIO; }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/cf42e73556a02b6789ca6c6f6aa058ac7f25b6b5/tftpDriver.c/buggy/c/src/libnetworking/lib/tftpDriver.c
isatty (int fd)
int isatty( int fd )
isatty (int fd){ struct stat buf; if (fstat (fd, &buf) < 0) return 0; if (S_ISCHR (buf.st_mode)) return 1; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/isatty.c/clean/c/src/lib/libc/isatty.c
isatty (int fd){ struct stat buf; if (fstat (fd, &buf) < 0) return 0; if (S_ISCHR (buf.st_mode)) return 1; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/isatty.c/clean/c/src/lib/libc/isatty.c
}
case t_QFI:case t_QFR: break; default: err(typeer,"division"); } /*Here tx==t_QFI || tx==t_QFR*/
gdiv(GEN x, GEN y){ long tx = typ(x), ty = typ(y), lx,ly,vx,vy,i,j,k,l,av,tetpil; GEN z,p1,p2,p3; if (y == gun) return gcopy(x); if (tx==t_INT && is_const_t(ty)) { switch (signe(x)) { case 0: if (gcmp0(y)) err(gdiver2); if (ty != t_INTMOD) return gzero; z = cgetg(3,t_INTMOD); icopyifstack(y[1],z[1]); z[2]=zero; return z; case 1: if (is_pm1(x)) return ginv(y); break; case -1: if (is_pm1(x)) { av = avma; return gerepileupto(av, ginv(gneg(y))); } } switch(ty) { case t_INT: av=avma; z=dvmdii(x,y,&p1); if (p1==gzero) return z; (void)new_chunk((lgefint(x) + lgefint(y)) << 2); p1 = mppgcd(y,p1); avma=av; z=cgetg(3,t_FRAC); if (is_pm1(p1)) { z[1]=licopy(x); z[2]=licopy(y); } else { z[1]=ldivii(x,p1); z[2]=ldivii(y,p1); } fix_frac(z); return z; case t_REAL: return divir(x,y); case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)y[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii(modii(x,p2), mpinvmod((GEN)y[2],p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRAC: z=cgetg(3,t_FRAC); p1 = mppgcd(x,(GEN)y[1]); if (is_pm1(p1)) { avma = (long)z; tetpil = 0; z[2] = licopy((GEN)y[1]); } else { x = divii(x,p1); tetpil = avma; z[2] = ldivii((GEN)y[1], p1); } z[1] = lmulii((GEN)y[2], x); fix_frac(z); if (tetpil) { fix_frac_if_int_GC(z,tetpil); } else fix_frac_if_int(z); return z; case t_FRACN: z=cgetg(3,t_FRACN); z[1]=lmulii((GEN)y[2], x); z[2]=licopy((GEN)y[1]); fix_frac(z); return z; case t_PADIC: l=avma; p1=cgetp(y); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_COMPLEX: case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } } if (gcmp0(y)) err(gdiver2); if (is_const_t(tx) && is_const_t(ty)) { switch(tx) { case t_REAL: switch(ty) { case t_INT: return divri(x,y); case t_REAL: return divrr(x,y); case t_FRAC: case t_FRACN: l=avma; p1=cgetg(lg(x),t_REAL); gaffect(y,p1); return gerepile(l,(long)p1,divrr(x,p1)); case t_COMPLEX: z=cgetg(3,t_COMPLEX); l=avma; p1=gnorm(y); p2=gmul(x,(GEN)y[1]); p3=gmul(x,(GEN)y[2]); if (!gcmp0(p3)) p3 = gneg_i(p3); tetpil=avma; z[1]=ldiv(p2,p1); z[2]=ldiv(p3,p1); gerepilemanyvec(l,tetpil,z+1,2); return z; case t_QUAD: l=avma; p1=co8(y,lg(x)); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_INTMOD: case t_PADIC: err(gdiverf,tx,ty); } case t_INTMOD: switch(ty) { case t_INT: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)x[2], mpinvmod(y,p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; p1=(GEN)y[1]; if (p1==p2 || egalii(p1,p2)) { icopyifstack(p2,z[1]); } else { p2 = mppgcd(p1,p2); z[1] = (long)p2; } av=avma; (void)new_chunk(lgefint(x[1]) + (lgefint(p1) << 1)); p1=mulii((GEN)x[2], mpinvmod((GEN)y[2],p2)); avma=av; z[2]=lmodii(p1,p2); return z; case t_FRAC: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)y[2], mpinvmod((GEN)y[1],p2)); p1=mulii(modii(p1,p2),(GEN)x[2]); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRACN: l=avma; p1=gred(y); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_COMPLEX: case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); case t_PADIC: l=avma; p1=cgetg(3,t_INTMOD); p1[1]=x[1]; p1[2]=lgeti(lg(x[1])); gaffect(y,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_REAL: err(gdiverf,tx,ty); } case t_FRAC: case t_FRACN: switch(ty) { case t_INT: z = cgetg(3, tx); if (tx == t_FRAC) { p1 = mppgcd(y,(GEN)x[1]); if (is_pm1(p1)) { avma = (long)z; tetpil = 0; z[1] = licopy((GEN)x[1]); } else { y = divii(y,p1); tetpil = avma; z[1] = ldivii((GEN)x[1], p1); } } else { tetpil = 0; z[1] = licopy((GEN)x[1]); } z[2] = lmulii((GEN)x[2],y); fix_frac(z); if (tetpil) fix_frac_if_int_GC(z,tetpil); return z; case t_REAL: l=avma; p1=cgetg(lg(y),t_REAL); gaffect(x,p1); p2=divrr(p1,y); return gerepile(l,(long)p1,p2); case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)y[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)y[2],(GEN)x[2]); p1=mulii(mpinvmod(p1,p2), modii((GEN)x[1],p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRAC: if (tx == t_FRACN) ty=t_FRACN; case t_FRACN: z = cgetg(3,ty); if (ty == t_FRAC) { GEN x1 = (GEN)x[1], x2 = (GEN)x[2]; GEN y1 = (GEN)y[1], y2 = (GEN)y[2]; p1 = mppgcd(x1, y1); if (!is_pm1(p1)) { x1 = divii(x1,p1); y1 = divii(y1,p1); } p1 = mppgcd(x2, y2); if (!is_pm1(p1)) { x2 = divii(x2,p1); y2 = divii(y2,p1); } tetpil = avma; z[2] = lmulii(x2,y1); z[1] = lmulii(x1,y2); fix_frac(z); fix_frac_if_int_GC(z,tetpil); } else { z[1]=lmulii((GEN)x[1],(GEN)y[2]); z[2]=lmulii((GEN)x[2],(GEN)y[1]); fix_frac(z); } return z; case t_COMPLEX: z=cgetg(3,t_COMPLEX); l=avma; p1=gnorm(y); p2=gmul(x,(GEN)y[1]); p3=gmul(x,(GEN)y[2]); if(!gcmp0(p3)) p3 = gneg_i(p3); tetpil=avma; z[1]=ldiv(p2,p1); z[2]=ldiv(p3,p1); gerepilemanyvec(l,tetpil,z+1,2); return z; case t_PADIC: if (!signe(x[1])) return gzero; l=avma; p1=cgetp(y); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } case t_COMPLEX: switch(ty) { case t_INT: case t_REAL: case t_INTMOD: case t_FRAC: case t_FRACN: z=cgetg(3,t_COMPLEX); z[1]=ldiv((GEN)x[1],y); z[2]=ldiv((GEN)x[2],y); return z; case t_COMPLEX: l=avma; p1=gnorm(y); p2=gconj(y); p2=gmul(x,p2); tetpil=avma; return gerepile(l,tetpil, gdiv(p2,p1)); case t_PADIC: if (krosg(-1,(GEN)y[2])== -1) { z=cgetg(3,t_COMPLEX); z[1]=ldiv((GEN)x[1],y); z[2]=ldiv((GEN)x[2],y); return z; } av=avma; p1=cvtop(x,(GEN)y[2],precp(y)); tetpil=avma; return gerepile(av,tetpil,gdiv(p1,y)); case t_QUAD: lx=precision(x); if (!lx) err(gdiveri,tx,ty); l=avma; p1=co8(y,lx); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); } case t_PADIC: switch(ty) { case t_INT: case t_FRAC: case t_FRACN: l=avma; if (signe(x[4])) { p1=cgetp(x); gaffect(y,p1); } else p1=cvtop(y,(GEN)x[2],(valp(x)>0)?valp(x):1); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_INTMOD: l=avma; p1=cgetg(3,t_INTMOD); p1[1]=y[1]; p1[2]=lgeti(lg(y[1])); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_PADIC: if (!egalii((GEN)x[2],(GEN)y[2])) err(gdiveri,tx,ty); if (!signe(x[4])) { z=gcopy(x); setvalp(z,valp(x)-valp(y)); return z; } p1=(precp(x)>precp(y)) ? y : x; z=cgetp(p1); l=avma; setvalp(z,valp(x)-valp(y)); p2=mpinvmod((GEN)y[4],(GEN)p1[3]); modiiz(mulii((GEN)x[4],p2),(GEN)p1[3],(GEN)z[4]); avma=l; return z; case t_COMPLEX: case t_QUAD: l=avma; p1=gmul(x,gconj(y)); p2=gnorm(y); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,p2)); case t_REAL: err(talker,"forbidden division p-adic/R"); } case t_QUAD: switch (ty) { case t_INT: case t_INTMOD: case t_FRAC: case t_FRACN: z=cgetg(4,t_QUAD); copyifstack(x[1], z[1]); for (i=2; i<4; i++) z[i]=ldiv((GEN)x[i],y); return z; case t_REAL: l=avma; p1=co8(x,lg(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_PADIC: l=avma; p1=cvtop(x,(GEN)y[2],precp(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_COMPLEX: ly=precision(y); if (!ly) err(gdiveri,tx,ty); l=avma; p1=co8(x,ly); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_QUAD: k=x[1]; l=y[1]; if (!gegal((GEN)k,(GEN)l)) err(gdiveri,tx,ty); l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } } err(bugparier,"division"); } vx=gvar(x); vy=gvar(y); if (ty==t_POLMOD && (tx==t_POLMOD || vy<vx)) { z=cgetg(3,t_POLMOD); if (tx==t_POLMOD) { k=x[1]; l=y[1]; if (gegal((GEN)k,(GEN)l)) { copyifstack(k, z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)z[1]); p2 = gmul((GEN)x[2],p1); } else { vx=varn(x[1]); vy=varn(y[1]); if (vx==vy) { z[1]=lgcd((GEN)k,(GEN)l); av=avma; p1=ginvmod((GEN)y[2],(GEN)z[1]); p2=gmul((GEN)x[2],p1); } else { if (vx<vy) { copyifstack(k,z[1]); av=avma; p2=gdiv((GEN)x[2],y); } else { copyifstack(l,z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)z[1]); p2 = gmul(x, p1); } } } p2 = gmod(p2,(GEN)z[1]); } else { copyifstack(y[1],z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)y[1]); p2 = gmul(x,p1); } z[2]=lpileupto(av, p2); return z; } if (tx == t_POLMOD && vx<vy) { z=cgetg(3,t_POLMOD); copyifstack(x[1],z[1]); z[2]=ldiv((GEN)x[2],y); return z; } if (vx == vy) { av = avma; if (tx == t_POLMOD) return gerepileupto(av, gdiv(x, to_polmod(y,(GEN)x[1]))); if (ty == t_POLMOD) return gerepileupto(av, gdiv(to_polmod(x,(GEN)y[1]), y)); } /* now x and y are not both is_scalar_t */ lx = lg(x); if ((vx<vy && (!is_matvec_t(tx) || !is_matvec_t(ty))) || (vx==vy && is_scalar_t(ty)) || (is_matvec_t(tx) && !is_matvec_t(ty))) { if (tx == t_RFRAC) return divrfracscal(x,y); z = cgetg(lx,tx); if (tx == t_RFRACN) { z[2]=lmul((GEN)x[2],y); z[1]=lcopy((GEN)x[1]); return z; } switch(tx) { case t_POL: lx = lgef(x); case t_SER: z[1] = x[1]; case t_VEC: case t_COL: case t_MAT: if (ty == t_POLMOD || ty == t_INTMOD) { if (!gcmp1(y)) y = ginv(y); /* garbage, left alone */ for (i=lontyp[tx]; i<lx; i++) z[i]=lmul((GEN)x[i],y); return z; } else for (i=lontyp[tx]; i<lx; i++) z[i]=ldiv((GEN)x[i],y); return z; } err(typeer,"division"); } ly=lg(y); if (vy<vx || (vy==vx && is_scalar_t(tx))) { switch(ty) { case t_POL: if (lgef(y)==3) return gdiv(x,(GEN)y[2]); if (isexactzero(x)) return zeropol(vy); av=avma; z=cgetg(3,t_RFRAC); z[1]=(long)x; z[2]=(long)y; return gerepileupto(av,gred_rfrac(z)); case t_SER: if (gcmp0(x)) { l=avma; p1=ginv(y); tetpil=avma; /* a ameliorer !!!! */ return gerepile(l,tetpil,gmul(x,p1)); } p1 = (GEN)gpmalloc(ly*sizeof(long)); p1[0] = evaltyp(t_SER) | evallg(ly); p1[1] = evalsigne(1) | evalvalp(0) | evalvarn(vy); p1[2] = (long)x; for (i=3; i<ly; i++) p1[i]=zero; y = gdiv(p1,y); free(p1); return y; case t_RFRAC: return divscalrfrac(x,y); case t_RFRACN: z=cgetg(ly,t_RFRACN); z[1]=lmul(x,(GEN)y[2]); z[2]=lcopy((GEN)y[1]); return z; case t_MAT: if (ly==1 || lg(y[1])!=ly) err(gdiveri,tx,ty); l=avma; p1=invmat(y); tetpil=avma; return gerepile(l,tetpil,gmul(x,p1)); case t_VEC: case t_COL: err(gdiverf,tx,ty); } err(typeer,"division"); } /* ici vx=vy et tx>=10 et ty>=10*/ switch(tx) { case t_POL: switch(ty) { case t_POL: if (lgef(y)==3) return gdiv(x,(GEN)y[2]); if (isexactzero(x)) return zeropol(vy); av=avma; z=cgetg(3,t_RFRAC); z[1]=(long)x; z[2]=(long)y; return gerepileupto(av,gred_rfrac(z)); case t_SER: if (gcmp0(x)) return zeropol(vx); p1=greffe(x,ly,0); p2=gdiv(p1,y); free(p1); return p2; case t_RFRAC: return divscalrfrac(x,y); case t_RFRACN: z=cgetg(ly,t_RFRACN); z[1]=lmul(x,(GEN)y[2]); z[2]=lcopy((GEN)y[1]); return z; case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_SER: switch(ty) { case t_POL: p1=greffe(y,lx,0); p2=gdiv(x,p1); free(p1); return p2; case t_SER: { GEN y_lead; l = valp(x) - valp(y); if (gcmp0(x)) return zeroser(vx,l); y_lead = (GEN)y[2]; if (gcmp0(y_lead)) /* normalize denominator if leading term is 0 */ { err(warner,"normalizing a series with 0 leading term"); for (i=3,y++; i<ly; i++,y++) { y_lead = (GEN)y[2]; ly--; l--; if (!gcmp0(y_lead)) break; } if (i==ly) err(gdiver2); } if (ly < lx) lx = ly; p2 = (GEN)gpmalloc(lx*sizeof(long)); for (i=3; i<lx; i++) { p1 = (GEN)y[i]; if (isexactzero(p1)) p2[i] = 0; else { av = avma; p2[i] = lclone(gneg_i(p1)); avma = av; } } z = cgetg(lx,t_SER); z[1] = evalvalp(l) | evalvarn(vx) | evalsigne(1); z[2] = ldiv((GEN)x[2], y_lead); for (i=3; i<lx; i++) { av=avma; p1 = (GEN)x[i]; for (j=2; j<i; j++) { l = i-j+2; if (p2[l]) p1 = gadd(p1, gmul((GEN)z[j], (GEN)p2[l])); } tetpil=avma; z[i]=lpile(av,tetpil, gdiv(p1,y_lead)); } for (i=3; i<lx; i++) if (p2[i]) gunclone((GEN)p2[i]); free(p2); return z; } case t_RFRAC: case t_RFRACN: l=avma; p2=gmul(x,(GEN)y[2]); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,(GEN)y[1])); case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_RFRAC: case t_RFRACN: switch(ty) { case t_POL: if (tx==t_RFRAC) return divrfracscal(x,y); z=cgetg(3,t_RFRACN); z[2]=lmul((GEN)x[2],y); z[1]=lcopy((GEN)x[1]); return z; case t_SER: l=avma; p2=gmul((GEN)x[2],y); tetpil=avma; return gerepile(l,tetpil, gdiv((GEN)x[1],p2)); case t_RFRAC: case t_RFRACN: if (tx == t_RFRACN) ty=t_RFRACN; if (ty != t_RFRACN) return divrfrac(x,y); z=cgetg(3,t_RFRACN); z[1]=lmul((GEN)x[1],(GEN)y[2]); z[2]=lmul((GEN)x[2],(GEN)y[1]); return z; case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_VEC: case t_COL: case t_MAT: if (!is_matvec_t(ty)) { z=cgetg(lx,tx); for (i=1; i<lx; i++) z[i]=ldiv((GEN)x[i],y); return z; } if (ty!=t_MAT || ly==1 || lg(y[1])!=ly) err(gdiveri,tx,ty); l=avma; p1=invmat(y); tetpil=avma; return gerepile(l,tetpil,gmul(x,p1)); } if (tx==ty) { l=signe(y[2]); setsigne(y[2],-l); switch(tx) { case t_QFI: z = compimag(x,y); setsigne(y[2],l); return z; case t_QFR: k=signe(y[4]); setsigne(y[4],-k); z=compreal(x,y); setsigne(y[2],l); setsigne(y[4],k); return z; } } err(typeer,"division"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9994a44d79945c2def879828fd06b341ee460cc1/gen1.c/buggy/src/basemath/gen1.c
(Objects_Name) 0,
(rtems_name) 0,
void _Region_MP_Send_extract_proxy ( Thread_Control *the_thread){ _Region_MP_Send_process_packet( REGION_MP_EXTRACT_PROXY, the_thread->Wait.id, (Objects_Name) 0, the_thread->Object.id );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/regionmp.c/clean/cpukit/rtems/src/regionmp.c
return _MPCI_Send_request_packet(
return (rtems_status_code) _MPCI_Send_request_packet(
rtems_status_code _Region_MP_Send_request_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, void *segment, unsigned32 size, rtems_option option_set, rtems_interval timeout){ Region_MP_Packet *the_packet; switch ( operation ) { case REGION_MP_GET_SEGMENT_REQUEST: case REGION_MP_RETURN_SEGMENT_REQUEST: the_packet = _Region_MP_Get_packet(); the_packet->Prefix.the_class = MP_PACKET_REGION; the_packet->Prefix.length = sizeof ( Region_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); if ( ! _Options_Is_no_wait(option_set)) the_packet->Prefix.timeout = timeout; the_packet->operation = operation; the_packet->Prefix.id = region_id; the_packet->segment = segment; the_packet->size = size; the_packet->option_set = option_set; return _MPCI_Send_request_packet( rtems_get_node( region_id ), &the_packet->Prefix, STATES_READY /* Not used */ ); break; case REGION_MP_ANNOUNCE_CREATE: case REGION_MP_ANNOUNCE_DELETE: case REGION_MP_EXTRACT_PROXY: case REGION_MP_GET_SEGMENT_RESPONSE: case REGION_MP_RETURN_SEGMENT_RESPONSE: break; } /* * The following line is included to satisfy compilers which * produce warnings when a function does not end with a return. */ return RTEMS_INTERNAL_ERROR;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ffe316d5267c5e7ce99685be45efc9308b041dc6/regionmp.c/buggy/c/src/exec/rtems/src/regionmp.c
outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS);
if (sc->byte_transfers) { outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS); } else { outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); }
rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config){ int i; struct ne_softc *sc; struct ifnet *ifp; int mtu; /* Find a free driver. */ sc = NULL; for (i = 0; i < NNEDRIVER; ++i) { sc = &ne_softc[i]; ifp = &sc->arpcom.ac_if; if (ifp->if_softc == NULL) break; } if (sc == NULL) { printf ("Too many NE2000 drivers.\n"); return 0; } memset (sc, 0, sizeof *sc); /* Handle the options passed in by the caller. */ if (config->mtu != 0) mtu = config->mtu; else mtu = ETHERMTU; if (config->irno != 0) sc->irno = config->irno; else { /* We use 5 as the default IRQ. */ sc->irno = 5; } if (config->port != 0) sc->port = config->port; else { /* We use 0x300 as the default IO port number. */ sc->port = 0x300; } sc->accept_broadcasts = ! config->ignore_broadcast; if (config->hardware_address != NULL) memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); else { unsigned char prom[16]; int ia; /* Read the PROM to get the Ethernet hardware address. */ outport_byte (sc->port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); outport_byte (sc->port + RBCR0, 0); outport_byte (sc->port + RBCR1, 0); outport_byte (sc->port + RCR, MSK_MON); outport_byte (sc->port + TCR, MSK_LOOP); outport_byte (sc->port + IMR, 0); outport_byte (sc->port + ISR, 0xff); ne_read_data (sc, 0, sizeof prom, prom); outport_byte (sc->port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); for (ia = 0; ia < ETHER_ADDR_LEN; ++ia) sc->arpcom.ac_enaddr[ia] = prom[ia * 2]; } /* Set up the network interface. */ ifp->if_softc = sc; ifp->if_unit = i + 1; ifp->if_name = "ne"; ifp->if_mtu = mtu; ifp->if_init = ne_init; ifp->if_ioctl = ne_ioctl; ifp->if_start = ne_start; ifp->if_output = ether_output; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; if (ifp->if_snd.ifq_maxlen == 0) ifp->if_snd.ifq_maxlen = ifqmaxlen; /* Attach the interface. */ if_attach (ifp); ether_ifattach (ifp); return 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a43ad5cd29db6d89549dda1ee2cd3aa3fb6c7c8d/ne2000.c/clean/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
volatile unsigned32 *dma_control_status_reg; volatile unsigned16 *card_resource_reg; unsigned16 v;
volatile uint32_t *dma_control_status_reg; volatile uint16_t *card_resource_reg; uint16_t v;
boolean dmv177_z85c30_probe(int minor){ volatile unsigned32 *dma_control_status_reg; volatile unsigned16 *card_resource_reg; unsigned16 v; card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; v = *card_resource_reg & DMV170_SCC_INST_MASK; if ( v != DMV170_SCC_INSTALLED ) return FALSE; /* * Figure out the clock speed of the Z85C30 SCC */ dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG; if ( *dma_control_status_reg & DMV170_SCC_10MHZ ) Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10; else Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2; return TRUE;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ed9e44994265d3dccca845c7aade2f634184c339/conscfg.c/clean/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c
card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG;
card_resource_reg = (volatile uint16_t*) DMV170_CARD_RESORCE_REG;
boolean dmv177_z85c30_probe(int minor){ volatile unsigned32 *dma_control_status_reg; volatile unsigned16 *card_resource_reg; unsigned16 v; card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; v = *card_resource_reg & DMV170_SCC_INST_MASK; if ( v != DMV170_SCC_INSTALLED ) return FALSE; /* * Figure out the clock speed of the Z85C30 SCC */ dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG; if ( *dma_control_status_reg & DMV170_SCC_10MHZ ) Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10; else Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2; return TRUE;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ed9e44994265d3dccca845c7aade2f634184c339/conscfg.c/clean/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c
dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG;
dma_control_status_reg = (volatile uint32_t*)DMV170_DMA_CONTROL_STATUS_REG;
boolean dmv177_z85c30_probe(int minor){ volatile unsigned32 *dma_control_status_reg; volatile unsigned16 *card_resource_reg; unsigned16 v; card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; v = *card_resource_reg & DMV170_SCC_INST_MASK; if ( v != DMV170_SCC_INSTALLED ) return FALSE; /* * Figure out the clock speed of the Z85C30 SCC */ dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG; if ( *dma_control_status_reg & DMV170_SCC_10MHZ ) Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10; else Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2; return TRUE;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ed9e44994265d3dccca845c7aade2f634184c339/conscfg.c/clean/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c
pari_sp av = avma;
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
int iszero = 1;
#ifdef LONG_IS_64BIT long e = (n&1); n = (n+1) >> 1; #endif
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
#ifdef LONG_IS_64BIT n >>= 1; #endif
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
ulong a = va_arg(ap, long);
ulong a = (e && !i)? 0: va_arg(ap, long);
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
if (*y) iszero = 0;
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
if (iszero) { avma = av; return gen_0; } return x;
return int_normalize(x, 0);
mkintn(long n, ...){ va_list ap; pari_sp av = avma; GEN x, y; long i; int iszero = 1; va_start(ap,n);#ifdef LONG_IS_64BIT n >>= 1;#endif x = cgeti(n+2); x[1] = evallgefint(n+2) | evalsigne(1); y = int_MSW(x); for (i=0; i <n; i++) {#ifdef LONG_IS_64BIT ulong a = va_arg(ap, long); ulong b = va_arg(ap, long); *y = (a << 32) | b;#else *y = va_arg(ap, long);#endif if (*y) iszero = 0; y = int_precW(y); } va_end(ap); if (iszero) { avma = av; return gen_0; } return x;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2ce71fbc147336596ba502bd8836612581658d54/gen3.c/clean/src/basemath/gen3.c
return out;
friend std::ostream& operator<<(std::ostream& out, const pair& v) { out << *(v.first) << " " << *(v.second); }
7945 /local/tlutelli/issta_data/temp/c/2005_temp/2005/7945/1f8b74f5382b190ac41411c4e9498c762cd5050a/ObjectFileTest.cpp/buggy/src/test/ObjectFileTest.cpp
long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1];
long llist,i,nn; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p,T,DATA, pol = (GEN)nf[1];
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn);
if (DEBUGLEVEL) fprintferr("\n*** Look for subfields of degree %ld\n\n", d); TR = 0; av = avma; p = choose_prime(pol,dpol,deg(pol)/d,&ff,&listpotbl,&nn);
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL; CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf);
T = lift_intern(ffinit(p,nn, fetch_var())); DATA = NULL; LSB = cgetg(1,t_VEC); i = 1; llist = lg(listpotbl); CHANGE: DATA = compute_data(DATA,d,nf,ff,T,p);
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
av2 = avma; A=(GEN)listpotbl[i];
av2 = avma; A = (GEN)listpotbl[i];
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break;
case 5: fprintferr("exponent too small in factor( d(L) )\n"); break;
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta);
ESF = embedding_of_potential_subfields(CSF,DATA,rootsA,delta);
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
delete_var();
subfields_of_given_degree(GEN nf,GEN dpol,long d){ ulong av,av2,tetpil; long pp,llist,i,nn,N,vf; GEN listpotbl,ff,A,delta,rootsA,CSF,ESF,p1,LSB,p; GEN DATA, pol = (GEN)nf[1]; if (DEBUGLEVEL) fprintferr("\n*** Looking for subfields of degree %ld\n\n", d); TR = 0; av = avma; vf = fetch_var(); N = deg(pol); pp = choose_prime(pol,dpol,N/d,&ff,&listpotbl,&nn); if (!listpotbl) { avma=av; return cgetg(1,t_VEC); } llist=lg(listpotbl); p = stoi(pp); LSB = cgetg(1,t_VEC); i = 1; DATA = NULL;CHANGE: DATA = compute_data(DATA,nf,ff,p,d,nn,vf); for (; i<llist; i++) { av2 = avma; A=(GEN)listpotbl[i]; if (DEBUGLEVEL > 1) fprintferr("\n* Potential block # %ld: %Z\n",i,A); CSF = cand_for_subfields(A,DATA,&delta,&rootsA); if (typ(CSF)==t_INT) { avma = av2; if (DEBUGLEVEL > 1) switch(itos(CSF)) { case 0: fprintferr("changing f(x): non separable g(x)\n"); break; case 1: fprintferr("coeff too big for pol g(x)\n"); break; case 2: fprintferr("changing f(x): p divides disc(g(x))\n"); break; case 3: fprintferr("non irreducible polynomial g(x)\n"); break; case 4: fprintferr("prime to d(L) part of d(g) not a square\n"); break; case 5: fprintferr("too small exponent of a prime factor in d(L)\n"); break; case 6: fprintferr("the d-th power of d(K) does not divide d(L)\n"); } switch(itos(CSF)) { case 0: case 2: goto CHANGE; } } else { if (DEBUGLEVEL) fprintferr("candidate = %Z\n",CSF); ESF = embedding_of_potential_subfields(nf,CSF,DATA,rootsA,delta); if (!ESF) avma = av2; else { if (DEBUGLEVEL) fprintferr("embedding = %Z\n",ESF); p1 = cgetg(3,t_VEC); p1[1] = (long)CSF; p1[2] = (long)ESF; p1 = _vec(p1); tetpil = avma; LSB = gerepile(av2,tetpil, concat(LSB, p1)); } } } for (i=1; i<llist; i++) free((void*)listpotbl[i]); delete_var(); free((void*)(listpotbl-1)); tetpil=avma; if (DEBUGLEVEL) fprintferr("\nSubfields of degree %ld: %Z\n",d, LSB); return gerepile(av,tetpil,gcopy(LSB));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59af7aa1a95aeb4e670f3d2cf01cd1e105edb8c4/subfield.c/buggy/src/modules/subfield.c
z=Flx_recipspec(x+2+lead,ld,ld); /* z = rec(x)*/ z=Flx_mulspec(z+2,mg+2,p,min(ld,lgpol(z)),lm);/* z = rec(x) * mg */ z=Flx_recipspec(z+2,lgpol(z),ld); /* z = rec (rec(x) * mg) */ z=Flx_mulspec(z+2,T+2,p,min(ld,lgpol(z)),lt); /* z *= pol */
z=Flx_recipspec(x+2+lead,ld,ld); /* z = rec(x) lz<=ld*/ z=Flx_mulspec(z+2,mg+2,p,lgpol(z),lm); /* z = rec(x) * mg lz<=ld+lm*/ z=Flx_recipspec(z+2,min(ld,lgpol(z)),ld); /* z = rec (rec(x) * mg) lz<=ld*/ z=Flx_mulspec(z+2,T+2,p,lgpol(z),lt); /* z *= pol lz<=ld+lt*/
Flx_rem_montgomery(GEN x, GEN mg, GEN T, ulong p){ pari_sp ltop=avma; GEN z; long l=lgpol(x); long lt=degpol(T); /*We discard the leading term*/ long lead=lt-1; long ld=l-lt+1; long lm=min(ld,lgpol(mg)); if (l<=lt) return vecsmall_copy(x); new_chunk(lt); z=Flx_recipspec(x+2+lead,ld,ld); /* z = rec(x)*/ z=Flx_mulspec(z+2,mg+2,p,min(ld,lgpol(z)),lm);/* z = rec(x) * mg */ z=Flx_recipspec(z+2,lgpol(z),ld); /* z = rec (rec(x) * mg) */ z=Flx_mulspec(z+2,T+2,p,min(ld,lgpol(z)),lt); /* z *= pol */ avma=ltop; z=Flx_subspec(x+2,z+2,p,lt,min(lt,lgpol(z))); /* z = x - z */ z[1]=T[1]; return z;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/41b3a0c2ecc134e1ecae95bf5601e681cc9b0fdf/Flx.c/buggy/src/basemath/Flx.c
z=Flx_subspec(x+2,z+2,p,lt,min(lt,lgpol(z))); /* z = x - z */
z=Flx_subspec(x+2,z+2,p,lt,min(lt,lgpol(z)));/* z = x - z lz<=lt */
Flx_rem_montgomery(GEN x, GEN mg, GEN T, ulong p){ pari_sp ltop=avma; GEN z; long l=lgpol(x); long lt=degpol(T); /*We discard the leading term*/ long lead=lt-1; long ld=l-lt+1; long lm=min(ld,lgpol(mg)); if (l<=lt) return vecsmall_copy(x); new_chunk(lt); z=Flx_recipspec(x+2+lead,ld,ld); /* z = rec(x)*/ z=Flx_mulspec(z+2,mg+2,p,min(ld,lgpol(z)),lm);/* z = rec(x) * mg */ z=Flx_recipspec(z+2,lgpol(z),ld); /* z = rec (rec(x) * mg) */ z=Flx_mulspec(z+2,T+2,p,min(ld,lgpol(z)),lt); /* z *= pol */ avma=ltop; z=Flx_subspec(x+2,z+2,p,lt,min(lt,lgpol(z))); /* z = x - z */ z[1]=T[1]; return z;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/41b3a0c2ecc134e1ecae95bf5601e681cc9b0fdf/Flx.c/buggy/src/basemath/Flx.c
if ( diop == 0 ) return -1;
if ( diop == 0 ) { ret = -1; break; }
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return 0;
break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0;
ret = ((iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC) != 0); break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return 0;
break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return rtems_libio_to_fcntl_flags( iop->flags );
ret = rtems_libio_to_fcntl_flags( iop->flags );
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
* XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /*
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
iop->flags = flags; return 0;
iop->flags = (iop->flags & ~(O_APPEND | O_NONBLOCK)) | (flags & (O_APPEND | O_NONBLOCK)); break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
errno = ENOTSUP; ret = -1; break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
errno = ENOTSUP; ret = -1; break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
errno = ENOTSUP; ret = -1; break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
errno = ENOTSUP; ret = -1; break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
errno = ENOTSUP; ret = -1; break;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
return -1;
if ((ret >= 0) && iop->handlers->fcntl) { int err = (*iop->handlers->fcntl)( cmd, iop ); if (err) { errno = err; ret = -1; } } return ret;
int fcntl( int fd, int cmd, ...){ va_list ap; rtems_libio_t *iop; rtems_libio_t *diop; int fd2; int flags; va_start( ap, cmd ); rtems_libio_check_fd( fd ); iop = rtems_libio_iop( fd ); rtems_libio_check_is_open(iop); /* * Now process the fcntl(). */ /* * This switch should contain all the cases from POSIX. */ switch ( cmd ) { case F_DUPFD: /* dup */ fd2 = va_arg( ap, int ); if ( fd2 ) diop = rtems_libio_iop( fd2 ); else { /* allocate a file control block */ diop = rtems_libio_allocate(); if ( diop == 0 ) return -1; } diop->handlers = iop->handlers; diop->file_info = iop->file_info; diop->flags = iop->flags; diop->pathinfo = iop->pathinfo; return 0; case F_GETFD: /* get f_flags */ if ( iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC ) return 1; return 0; case F_SETFD: /* set f_flags */ /* * Interpret the third argument as the "close on exec()" flag. * If this argument is 1, then the file descriptor is to be closed * if a new process is exec()'ed. Since RTEMS does not support * processes, then we can ignore this one except to make * F_GETFD work. */ if ( va_arg( ap, int ) ) iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; else iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; return 0; case F_GETFL: /* more flags (cloexec) */ return rtems_libio_to_fcntl_flags( iop->flags ); case F_SETFL: flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); /* * XXX Double check this in the POSIX spec. According to the Linux * XXX man page, only these flags can be added. */ flags = (iop->flags & ~(O_APPEND|O_NONBLOCK)) | (flags & (O_APPEND|O_NONBLOCK)); /* * XXX If we are turning on append, should we seek to the end? */ iop->flags = flags; return 0; case F_GETLK: return -1; case F_SETLK: return -1; case F_SETLKW: return -1; case F_SETOWN: /* for sockets. */ return -1; case F_GETOWN: /* for sockets. */ return -1; default: break; } return -1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/fcntl.c/clean/cpukit/libcsupport/src/fcntl.c
if ( !status )
if ( status != 0 )
int sem_unlink( const char *name){ int status; register POSIX_Semaphore_Control *the_semaphore; Objects_Id the_semaphore_id; Objects_Locations location; status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id ); if ( !status ) set_errno_and_return_minus_one( status ); the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location ); switch ( location ) { case OBJECTS_ERROR: set_errno_and_return_minus_one( EINVAL ); case OBJECTS_REMOTE: _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); set_errno_and_return_minus_one( EINVAL ); case OBJECTS_LOCAL:#if defined(RTEMS_MULTIPROCESSING) if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) { _Objects_MP_Close( &_POSIX_Semaphore_Information, the_semaphore->Object.id ); }#endif the_semaphore->linked = FALSE; _POSIX_Semaphore_Delete( the_semaphore ); _Thread_Enable_dispatch(); return 0; } return POSIX_BOTTOM_REACHED();}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/17879f4750a2bc0d556c8cd1d0f6715b127d681a/semunlink.c/clean/cpukit/posix/src/semunlink.c
_POSIX_Semaphore_Namespace_remove( the_semaphore );
int sem_unlink( const char *name){ int status; register POSIX_Semaphore_Control *the_semaphore; Objects_Id the_semaphore_id; Objects_Locations location; status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id ); if ( !status ) set_errno_and_return_minus_one( status ); the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location ); switch ( location ) { case OBJECTS_ERROR: set_errno_and_return_minus_one( EINVAL ); case OBJECTS_REMOTE: _Thread_Dispatch(); return POSIX_MP_NOT_IMPLEMENTED(); set_errno_and_return_minus_one( EINVAL ); case OBJECTS_LOCAL:#if defined(RTEMS_MULTIPROCESSING) if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) { _Objects_MP_Close( &_POSIX_Semaphore_Information, the_semaphore->Object.id ); }#endif the_semaphore->linked = FALSE; _POSIX_Semaphore_Delete( the_semaphore ); _Thread_Enable_dispatch(); return 0; } return POSIX_BOTTOM_REACHED();}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/17879f4750a2bc0d556c8cd1d0f6715b127d681a/semunlink.c/clean/cpukit/posix/src/semunlink.c
_Thread_Heir == _Thread_Executing)
_Thread_Heir == _Thread_Executing);
rtems_isr Clock_isr( rtems_vector_number vector){#ifdef CLOCK_DRIVER_USE_FAST_IDLE do { Clock_driver_ticks += 1; rtems_clock_tick(); } while ( _Thread_Executing == _Thread_Idle && _Thread_Heir == _Thread_Executing) Clock_driver_support_at_tick(); return;#else /* * Do the hardware specific per-tick action. * * The counter/timer may or may not be set to automatically reload. */ Clock_driver_support_at_tick(); /* * The driver has seen another tick. */ Clock_driver_ticks += 1; /* */#ifndef CLOCK_DRIVER_ISRS_ARE_ONE_MILLISECOND rtems_clock_tick();#else#error "Clock driver shell: Does not currently support counting mseconds."#endif#endif}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e10f5131ce8127f107cf593749edc86b0ffca78/clockdrv_shell.c/clean/c/src/lib/libbsp/shared/clockdrv_shell.c
outport_byte ( TMRCFG , 0x80 ); outport_byte ( TMRCON , 0x34 ); outport_byte ( TMR0 , 0xA8 ); outport_byte ( TMR0 , 0x04 ); outport_byte ( TMRCFG , 0x00 );
outport_byte ( TMRCFG , 0x00 ); /* enable the counter timer */
void ClockOn(const rtems_irq_connect_data* unused){ outport_byte ( TMRCFG , 0x80 ); outport_byte ( TMRCON , 0x34 ); outport_byte ( TMR0 , 0xA8 ); outport_byte ( TMR0 , 0x04 ); outport_byte ( TMRCFG , 0x00 ); }
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/479c86ddbd7324fb0b85aa8a94f7658c85fb8dbe/ckinit.c/buggy/c/src/lib/libbsp/i386/i386ex/clock/ckinit.c
rtems_unsigned32 s;
uint32_t s;
rtems_symbol_name_lookup( rtems_symbol_table_t *table, char *name ){ rtems_unsigned32 s; rtems_symbol_t *sp; if (table == 0) { table = rtems_monitor_symbols; if (table == 0) return NULL; } for (s = 0, sp = table->addresses; s < table->next; s++, sp++) { if ( strcasecmp(sp->name, name) == 0 ) return sp; } return NULL;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-symbols.c/clean/cpukit/libmisc/monitor/mon-symbols.c
rtems_unsigned32 value
uint32_t value
rtems_symbol_value_lookup( rtems_symbol_table_t *table, rtems_unsigned32 value ){ rtems_symbol_t *sp; rtems_symbol_t *base; rtems_symbol_t *best = 0; rtems_unsigned32 distance; rtems_unsigned32 best_distance = ~0; rtems_unsigned32 elements; if (table == 0) table = rtems_monitor_symbols; if ((table == 0) || (table->size == 0)) return 0; if (table->sorted == 0) rtems_symbol_sort(table); base = table->addresses; elements = table->next; while (elements) { sp = base + (elements / 2); if (value < sp->value) elements /= 2; else if (value > sp->value) { distance = value - sp->value; if (distance < best_distance) { best_distance = distance; best = sp; } base = sp + 1; elements = (elements / 2) - (elements % 2 ? 0 : 1); } else return sp; } if (value == base->value) return base; return best;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-symbols.c/clean/cpukit/libmisc/monitor/mon-symbols.c
rtems_unsigned32 distance; rtems_unsigned32 best_distance = ~0; rtems_unsigned32 elements;
uint32_t distance; uint32_t best_distance = ~0; uint32_t elements;
rtems_symbol_value_lookup( rtems_symbol_table_t *table, rtems_unsigned32 value ){ rtems_symbol_t *sp; rtems_symbol_t *base; rtems_symbol_t *best = 0; rtems_unsigned32 distance; rtems_unsigned32 best_distance = ~0; rtems_unsigned32 elements; if (table == 0) table = rtems_monitor_symbols; if ((table == 0) || (table->size == 0)) return 0; if (table->sorted == 0) rtems_symbol_sort(table); base = table->addresses; elements = table->next; while (elements) { sp = base + (elements / 2); if (value < sp->value) elements /= 2; else if (value > sp->value) { distance = value - sp->value; if (distance < best_distance) { best_distance = distance; best = sp; } base = sp + 1; elements = (elements / 2) - (elements % 2 ? 0 : 1); } else return sp; } if (value == base->value) return base; return best;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-symbols.c/clean/cpukit/libmisc/monitor/mon-symbols.c
rtems_unsigned32 s;
uint32_t s;
rtems_monitor_symbol_dump_all( rtems_symbol_table_t *table, boolean verbose){ rtems_unsigned32 s; rtems_symbol_t *sp; if (table == 0) { table = rtems_monitor_symbols; if (table == 0) return; } if (table->sorted == 0) rtems_symbol_sort(table); for (s = 0, sp = table->addresses; s < table->next; s++, sp++) { rtems_monitor_symbol_t canonical_symbol; rtems_monitor_symbol_canonical(&canonical_symbol, sp); rtems_monitor_symbol_dump(&canonical_symbol, TRUE); printf("\n"); }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-symbols.c/clean/cpukit/libmisc/monitor/mon-symbols.c
* trap 0 which we will use as a shutdown.
* trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f * which cannot happen and where some of the space is used to pass * paramaters to the program.
void bsp_spurious_initialize(){ rtems_unsigned32 trap; for ( trap=0 ; trap<256 ; trap++ ) { /* * Skip window overflow, underflow, and flush as well as software * trap 0 which we will use as a shutdown. */ if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80) continue; set_vector( bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 ); }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ba2adf540ec8aa5455d09c729c948f9b6742e42e/spurious.c/buggy/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80)
if (( trap == 5 || trap == 6 || trap == 0x83 ) || (( trap >= 0x70 ) && ( trap <= 0x80 )))
void bsp_spurious_initialize(){ rtems_unsigned32 trap; for ( trap=0 ; trap<256 ; trap++ ) { /* * Skip window overflow, underflow, and flush as well as software * trap 0 which we will use as a shutdown. */ if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80) continue; set_vector( bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 ); }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ba2adf540ec8aa5455d09c729c948f9b6742e42e/spurious.c/buggy/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
ERC32_MEC.Interrupt_Mask = mask; sparc_enable_interrupts(level);
void bsp_spurious_initialize(){ rtems_unsigned32 trap; for ( trap=0 ; trap<256 ; trap++ ) { /* * Skip window overflow, underflow, and flush as well as software * trap 0 which we will use as a shutdown. */ if ( trap == 5 || trap == 6 || trap == 0x83 || trap == 0x80) continue; set_vector( bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 ); }}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ba2adf540ec8aa5455d09c729c948f9b6742e42e/spurious.c/buggy/c/src/lib/libbsp/sparc/erc32/startup/spurious.c
unsigned32 status
uint32_t status
void Stack_check_Fatal_extension( Internal_errors_Source source, boolean is_internal, unsigned32 status){#ifndef DONT_USE_FATAL_EXTENSION if (status == 0) Stack_check_Dump_usage();#endif}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 *p;
uint32_t *p;
void Stack_check_Initialize( void ){#if 0 rtems_status_code status; Objects_Id id_ignored;#endif unsigned32 *p;#if 0 unsigned32 i; unsigned32 api_index; Thread_Control *the_thread; Objects_Information *information;#endif if (stack_check_initialized) return; /* * Dope the pattern and fill areas */ for ( p = Stack_check_Pattern.pattern; p < &Stack_check_Pattern.pattern[PATTERN_SIZE_WORDS]; p += 4 ) { p[0] = 0xFEEDF00D; /* FEED FOOD to BAD DOG */ p[1] = 0x0BAD0D06; p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */ p[3] = 0x600D0D06; };#if 0 status = rtems_extension_create( rtems_build_name( 'S', 'T', 'C', 'K' ), &Stack_check_Extension_table, &id_ignored ); assert ( status == RTEMS_SUCCESSFUL );#endif Stack_check_Blown_task = 0; /* * If installed by a task, that task will not get setup properly * since it missed out on the create hook. This will cause a * failure on first switch out of that task. * So pretend here that we actually ran create and begin extensions. */ /* XXX * * Technically this has not been done for any task created before this * happened. So just run through them and fix the situation. */#if 0 if (_Thread_Executing) { Stack_check_Create_extension(_Thread_Executing, _Thread_Executing); }#endif#if 0 for ( api_index = 1; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { if ( !_Objects_Information_table[ api_index ] ) continue; information = _Objects_Information_table[ api_index ][ 1 ]; if ( information ) { for ( i=1 ; i <= information->maximum ; i++ ) { the_thread = (Thread_Control *)information->local_table[ i ]; Stack_check_Create_extension( the_thread, the_thread ); } } }#endif /* * If appropriate, setup the interrupt stack for high water testing * also. */#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) if (_CPU_Interrupt_stack_low && _CPU_Interrupt_stack_high) { stack_check_interrupt_stack.area = _CPU_Interrupt_stack_low; stack_check_interrupt_stack.size = (char *) _CPU_Interrupt_stack_high - (char *) _CPU_Interrupt_stack_low; stack_check_dope_stack(&stack_check_interrupt_stack); }#endif#ifdef DONT_USE_FATAL_EXTENSION#ifdef RTEMS_DEBUG /* * this would normally be called by a fatal extension * handler, but we don't run fatal extensions unless * we fatal error. */ atexit(Stack_check_Dump_usage);#endif#endif stack_check_initialized = 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 i; unsigned32 api_index;
uint32_t i; uint32_t api_index;
void Stack_check_Initialize( void ){#if 0 rtems_status_code status; Objects_Id id_ignored;#endif unsigned32 *p;#if 0 unsigned32 i; unsigned32 api_index; Thread_Control *the_thread; Objects_Information *information;#endif if (stack_check_initialized) return; /* * Dope the pattern and fill areas */ for ( p = Stack_check_Pattern.pattern; p < &Stack_check_Pattern.pattern[PATTERN_SIZE_WORDS]; p += 4 ) { p[0] = 0xFEEDF00D; /* FEED FOOD to BAD DOG */ p[1] = 0x0BAD0D06; p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */ p[3] = 0x600D0D06; };#if 0 status = rtems_extension_create( rtems_build_name( 'S', 'T', 'C', 'K' ), &Stack_check_Extension_table, &id_ignored ); assert ( status == RTEMS_SUCCESSFUL );#endif Stack_check_Blown_task = 0; /* * If installed by a task, that task will not get setup properly * since it missed out on the create hook. This will cause a * failure on first switch out of that task. * So pretend here that we actually ran create and begin extensions. */ /* XXX * * Technically this has not been done for any task created before this * happened. So just run through them and fix the situation. */#if 0 if (_Thread_Executing) { Stack_check_Create_extension(_Thread_Executing, _Thread_Executing); }#endif#if 0 for ( api_index = 1; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { if ( !_Objects_Information_table[ api_index ] ) continue; information = _Objects_Information_table[ api_index ][ 1 ]; if ( information ) { for ( i=1 ; i <= information->maximum ; i++ ) { the_thread = (Thread_Control *)information->local_table[ i ]; Stack_check_Create_extension( the_thread, the_thread ); } } }#endif /* * If appropriate, setup the interrupt stack for high water testing * also. */#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) if (_CPU_Interrupt_stack_low && _CPU_Interrupt_stack_high) { stack_check_interrupt_stack.area = _CPU_Interrupt_stack_low; stack_check_interrupt_stack.size = (char *) _CPU_Interrupt_stack_high - (char *) _CPU_Interrupt_stack_low; stack_check_dope_stack(&stack_check_interrupt_stack); }#endif#ifdef DONT_USE_FATAL_EXTENSION#ifdef RTEMS_DEBUG /* * this would normally be called by a fatal extension * handler, but we don't run fatal extensions unless * we fatal error. */ atexit(Stack_check_Dump_usage);#endif#endif stack_check_initialized = 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 i; unsigned32 api_index;
uint32_t i; uint32_t api_index;
void Stack_check_Dump_usage( void ){ unsigned32 i; unsigned32 api_index; Thread_Control *the_thread; unsigned32 hit_running = 0; Objects_Information *information; if (stack_check_initialized == 0) return; printf("Stack usage by thread\n"); printf( " ID NAME LOW HIGH AVAILABLE USED\n" ); for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { if ( !_Objects_Information_table[ api_index ] ) continue; information = _Objects_Information_table[ api_index ][ 1 ]; if ( information ) { for ( i=1 ; i <= information->maximum ; i++ ) { the_thread = (Thread_Control *)information->local_table[ i ]; Stack_check_Dump_threads_usage( the_thread ); if ( the_thread == _Thread_Executing ) hit_running = 1; } } } if ( !hit_running ) Stack_check_Dump_threads_usage( _Thread_Executing ); /* dump interrupt stack info if any */ Stack_check_Dump_threads_usage((Thread_Control *) -1);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 hit_running = 0;
uint32_t hit_running = 0;
void Stack_check_Dump_usage( void ){ unsigned32 i; unsigned32 api_index; Thread_Control *the_thread; unsigned32 hit_running = 0; Objects_Information *information; if (stack_check_initialized == 0) return; printf("Stack usage by thread\n"); printf( " ID NAME LOW HIGH AVAILABLE USED\n" ); for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) { if ( !_Objects_Information_table[ api_index ] ) continue; information = _Objects_Information_table[ api_index ][ 1 ]; if ( information ) { for ( i=1 ; i <= information->maximum ; i++ ) { the_thread = (Thread_Control *)information->local_table[ i ]; Stack_check_Dump_threads_usage( the_thread ); if ( the_thread == _Thread_Executing ) hit_running = 1; } } } if ( !hit_running ) Stack_check_Dump_threads_usage( _Thread_Executing ); /* dump interrupt stack info if any */ Stack_check_Dump_threads_usage((Thread_Control *) -1);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/check.c/clean/cpukit/libmisc/stackchk/check.c
unsigned32 vector,
uint32_t vector,
void _CPU_ISR_install_vector( unsigned32 vector, proc_ptr new_handler, proc_ptr *old_handler){ proc_ptr ignored; *old_handler = _ISR_Vector_table[ vector ]; _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); _ISR_Vector_table[ vector ] = new_handler;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/d86bae84e6165161c445ff5f5a07809d4a36b34e/cpu.c/buggy/cpukit/score/cpu/m68k/cpu.c
unsigned32 slot;
uint32_t slot;
void _CPU_Initialize( rtems_cpu_table *cpu_table, void (*thread_dispatch) /* ignored on this CPU */){#if ( M68K_HAS_VBR == 0 ) /* fill the isr redirect table with the code to place the format/id onto the stack */ unsigned32 slot; for (slot = 0; slot < CPU_INTERRUPT_NUMBER_OF_VECTORS; slot++) { _CPU_ISR_jump_table[slot].move_a7 = M68K_MOVE_A7; _CPU_ISR_jump_table[slot].format_id = slot << 2; _CPU_ISR_jump_table[slot].jmp = M68K_JMP; _CPU_ISR_jump_table[slot].isr_handler = (unsigned32) 0xDEADDEAD; }#endif /* M68K_HAS_VBR */ _CPU_Table = *cpu_table;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/d86bae84e6165161c445ff5f5a07809d4a36b34e/cpu.c/buggy/cpukit/score/cpu/m68k/cpu.c
_CPU_ISR_jump_table[slot].isr_handler = (unsigned32) 0xDEADDEAD;
_CPU_ISR_jump_table[slot].isr_handler = (uint32_t ) 0xDEADDEAD;
void _CPU_Initialize( rtems_cpu_table *cpu_table, void (*thread_dispatch) /* ignored on this CPU */){#if ( M68K_HAS_VBR == 0 ) /* fill the isr redirect table with the code to place the format/id onto the stack */ unsigned32 slot; for (slot = 0; slot < CPU_INTERRUPT_NUMBER_OF_VECTORS; slot++) { _CPU_ISR_jump_table[slot].move_a7 = M68K_MOVE_A7; _CPU_ISR_jump_table[slot].format_id = slot << 2; _CPU_ISR_jump_table[slot].jmp = M68K_JMP; _CPU_ISR_jump_table[slot].isr_handler = (unsigned32) 0xDEADDEAD; }#endif /* M68K_HAS_VBR */ _CPU_Table = *cpu_table;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/d86bae84e6165161c445ff5f5a07809d4a36b34e/cpu.c/buggy/cpukit/score/cpu/m68k/cpu.c
isatty (int fd)
int isatty( int fd )
isatty (int fd){ struct stat buf; if (fstat (fd, &buf) < 0) return 0; if (S_ISCHR (buf.st_mode)) return 1; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/isatty.c/clean/cpukit/libcsupport/src/isatty.c
isatty (int fd){ struct stat buf; if (fstat (fd, &buf) < 0) return 0; if (S_ISCHR (buf.st_mode)) return 1; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/isatty.c/clean/cpukit/libcsupport/src/isatty.c
while(gcmp0((GEN)cff[k-1])) k--; setlg(cff, k); if (DEBUGLEVEL > 3) fprintferr(" coeff_of_phi_ms: %ld coefficients kept out of %ld\n", k-1, N);
coeff_of_phi_ms(ulong p, GEN q, long m, GEN s, long N, GEN vz){ GEN bn, cff = cgetg(N+1, t_VEC); long k, j, l; bn = new_chunk(N+2); /* bn[i] = binom(k, i), i <= k */ l = lg(q); for (k = 0; k <= N; k++) { GEN t = cgeti(l); affsi(1, t); bn[k] = (long)t; } for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p1 = gzero, A = phi_ms(p, q, m, s, k, vz); for (j = k - 1; j > 0; j--) { GEN b = addii((GEN)bn[j], (GEN)bn[j-1]); if (cmpii(b, q) >= 0) b = subii(b, q); affii(b, (GEN)bn[j]); /* = binom(k, j+1) */ } for (j = 1; j < k; j++) p1 = addii(p1, mulii((GEN)bn[j], (GEN)cff[j])); cff[k] = (long)gerepileuptoint(av2, modii(subii(A, p1), q)); } return cff;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c
0
timer_overhead
rtems_task Task_2( rtems_task_argument argument){#if (MUST_WAIT_FOR_INTERRUPT == 1) while ( Interrupt_occurred == 0 );#endif end_time = Read_timer(); put_time( "interrupt entry overhead: returns to preempting task", Interrupt_enter_time, 1, 0, 0 ); put_time( "interrupt exit overhead: returns to preempting task", end_time, 1, 0, 0 ); fflush( stdout ); /* * Switch back to the other task to exit the test. */ _Thread_Dispatch_disable_level = 0; _Thread_Heir = (rtems_tcb *) _Thread_Ready_chain[254].first; _Context_Switch_necessary = 1; _Thread_Dispatch();}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ed07762c2d0c1989b05784306a8ab04bedd00ef7/task1.c/clean/c/src/tests/tmtests/tm27/task1.c