rem
stringlengths
0
83.5k
add
stringlengths
0
223k
context
stringlengths
10
471k
meta
stringlengths
120
236
if ((imr & (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)) && (isr & (ISR_PINT | ISR_TXDN | ISR_TXER))) { imr &= ~(IMR_PINTEN | IMR_PTXEN | IMR_TXEREN);
if (imr & isr & (IMR_PINTEN | IMR_TXEREN)) {
SONIC_STATIC rtems_isr sonic_interrupt_handler (rtems_vector_number v){ struct sonic_softc *sc = sonic_softc; unsigned32 isr, imr; void *rp;#if (NSONIC > 1) /* * Find the device which requires service */ for (;;) { if (sc->vector == v) break; if (++sc == &sonic[NSONIC]) return; /* Spurious interrupt? */ }#endif /* NSONIC > 1 */ /* * Get pointer to SONIC registers */ rp = sc->sonic; sc->Interrupts++; isr = (*sc->read_register)( rp, SONIC_REG_ISR ); imr = (*sc->read_register)( rp, SONIC_REG_IMR ); /* * Packet received or receive buffer area exceeded? */ if ((imr & (IMR_PRXEN | IMR_RBAEEN)) && (isr & (ISR_PKTRX | ISR_RBAE))) { imr &= ~(IMR_PRXEN | IMR_RBAEEN); sc->rxInterrupts++; rtems_event_send (sc->rxDaemonTid, INTERRUPT_EVENT); } /* * Packet started, transmitter done or transmitter error? */ if ((imr & (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)) && (isr & (ISR_PINT | ISR_TXDN | ISR_TXER))) { imr &= ~(IMR_PINTEN | IMR_PTXEN | IMR_TXEREN); sc->txInterrupts++; rtems_event_send (sc->txDaemonTid, INTERRUPT_EVENT); } (*sc->write_register)( rp, SONIC_REG_IMR, imr );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f1f42b454dc955624d7bb2d78c0c9718c814a24b/sonic.c/clean/c/src/libchip/network/sonic.c
(*sc->write_register)( rp, SONIC_REG_IMR, imr );
SONIC_STATIC rtems_isr sonic_interrupt_handler (rtems_vector_number v){ struct sonic_softc *sc = sonic_softc; unsigned32 isr, imr; void *rp;#if (NSONIC > 1) /* * Find the device which requires service */ for (;;) { if (sc->vector == v) break; if (++sc == &sonic[NSONIC]) return; /* Spurious interrupt? */ }#endif /* NSONIC > 1 */ /* * Get pointer to SONIC registers */ rp = sc->sonic; sc->Interrupts++; isr = (*sc->read_register)( rp, SONIC_REG_ISR ); imr = (*sc->read_register)( rp, SONIC_REG_IMR ); /* * Packet received or receive buffer area exceeded? */ if ((imr & (IMR_PRXEN | IMR_RBAEEN)) && (isr & (ISR_PKTRX | ISR_RBAE))) { imr &= ~(IMR_PRXEN | IMR_RBAEEN); sc->rxInterrupts++; rtems_event_send (sc->rxDaemonTid, INTERRUPT_EVENT); } /* * Packet started, transmitter done or transmitter error? */ if ((imr & (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)) && (isr & (ISR_PINT | ISR_TXDN | ISR_TXER))) { imr &= ~(IMR_PINTEN | IMR_PTXEN | IMR_TXEREN); sc->txInterrupts++; rtems_event_send (sc->txDaemonTid, INTERRUPT_EVENT); } (*sc->write_register)( rp, SONIC_REG_IMR, imr );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f1f42b454dc955624d7bb2d78c0c9718c814a24b/sonic.c/clean/c/src/libchip/network/sonic.c
printf( "What is maximum_messages? " );
printf( "What is maximum_messages? XXXX " );
void help_size(){int c = '\0';int break_loop;int total_size;int task_stacks;int interrupt_stack;int maximum_tasks, size_tasks;int maximum_sems, size_sems;int maximum_timers, size_timers;int maximum_msgqs, size_msgqs;int maximum_msgs, size_msgs_overhead;int maximum_regns, size_regns;int maximum_parts, size_parts;int maximum_ports, size_ports;int maximum_periods, size_periods;int maximum_extensions, size_extensions;int maximum_drvs, size_drvs;int maximum_fps, size_fps;int maximum_nodes, size_nodes;int maximum_gobjs, size_gobjs;int maximum_proxies, size_proxies;total_size = sys_req; /* Fixed Overhead */printf( "What is maximum_tasks? " );maximum_tasks = getint();size_tasks = PER_TASK * maximum_tasks;total_size += size_tasks;printf( "What is maximum_semaphores? " );maximum_sems = getint();size_sems = PER_SEMAPHORE * maximum_sems;total_size += size_sems;printf( "What is maximum_timers? " );maximum_timers = getint();size_timers = PER_TIMER * maximum_timers;total_size += size_timers;printf( "What is maximum_message_queues? " );maximum_msgqs = getint();size_msgqs = PER_MSGQ * maximum_msgqs;total_size += size_msgqs;printf( "What is maximum_messages? " );maximum_msgs = getint();size_msgs_overhead = PER_MSG_OVERHEAD * maximum_msgs;total_size += size_msgs_overhead;printf( "What is maximum_regions? " );maximum_regns = getint();size_regns = PER_REGN * maximum_regns;total_size += size_regns;printf( "What is maximum_partitions? " );maximum_parts = getint();size_parts = PER_PART * maximum_parts;total_size += size_parts;printf( "What is maximum_ports? " );maximum_ports = getint();size_ports = PER_PORT * maximum_ports;total_size += size_ports;printf( "What is maximum_periods? " );maximum_periods = getint();size_periods = PER_PORT * maximum_periods;total_size += size_periods;printf( "What is maximum_extensions? " );maximum_extensions = getint();size_extensions = PER_EXTENSION * maximum_extensions;total_size += size_extensions;printf( "What is number_of_device_drivers? " );maximum_drvs = getint();size_drvs = PER_DRV * maximum_drvs;total_size += size_drvs;printf( "What will be total stack requirement for all tasks? " );task_stacks = getint();total_size += task_stacks;printf( "What is the size of the interrupt stack? " );interrupt_stack = getint();total_size += interrupt_stack;printf( "How many tasks will be created with the FP flag? " );maximum_fps = getint();size_fps = PER_FPTASK * maximum_fps;total_size += size_fps;printf( "Is this a single processor system? " );for ( break_loop=0 ; !break_loop; c = getchar() ) { switch ( c ) { case 'Y': case 'y': case 'N': case 'n': break_loop = 1; break; }}printf( "%c\n", c );if ( c == 'n' || c == 'N' ) { printf( "What is maximum_nodes? " ); maximum_nodes = getint(); size_nodes = PER_NODE * maximum_nodes; total_size += size_nodes; printf( "What is maximum_global_objects? " ); maximum_gobjs = getint(); size_gobjs = PER_GOBJECT * maximum_gobjs; total_size += size_gobjs; printf( "What is maximum_proxies? " ); maximum_proxies = getint(); size_proxies = PER_PROXY * maximum_proxies; total_size += size_proxies;} else { maximum_nodes = 0; size_nodes = PER_NODE * 0; maximum_gobjs = 0; size_gobjs = PER_GOBJECT * 0; maximum_proxies = 0; size_proxies = PER_PROXY * 0;}printf( "\n\n" );printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );printf( " Tasks - %03d * %03d = %d\n", maximum_tasks, PER_TASK, size_tasks );printf( " Semaphores - %03d * %03d = %d\n", maximum_sems, PER_SEMAPHORE, size_sems );printf( " Timers - %03d * %03d = %d\n", maximum_timers, PER_TIMER, size_timers );printf( " Msg Queues - %03d * %03d = %d\n", maximum_msgqs, PER_MSGQ, size_msgqs );printf( " Messages Overhead - %03d * %03d = %d\n", maximum_msgs, PER_MSG_OVERHEAD, size_msgs_overhead );printf( " Regions - %03d * %03d = %d\n", maximum_regns, PER_REGN, size_regns);printf( " Partitions - %03d * %03d = %d\n", maximum_parts, PER_PART, size_parts );printf( " Periods - %03d * %03d = %d\n", maximum_periods, PER_PERIOD, size_periods );printf( " Extensions - %03d * %03d = %d\n", maximum_extensions, PER_EXTENSION, size_extensions );printf( " Device Drivers - %03d * %03d = %d\n", maximum_drvs, PER_DRV, size_drvs );printf( " System Requirements - %04d = %d\n", sys_req, sys_req );printf( " Floating Point Tasks - %03d * %03d = %d\n", maximum_fps, PER_FPTASK, size_fps );printf( " Application Task Stacks - = %d\n", task_stacks );printf( " Interrupt Stacks - = %d\n", task_stacks );printf( " \n" );printf( " Global object tables - %03d * %03d = %d\n", maximum_nodes, PER_NODE, size_nodes );printf( " Global objects - %03d * %03d = %d\n", maximum_gobjs, PER_GOBJECT, size_gobjs );printf( " Proxies - %03d * %03d = %d\n", maximum_proxies, PER_PROXY, size_proxies );printf( "\n\n" );printf( " TOTAL = %d bytes\n", total_size );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3652ad356bf13abe0963c992cbbda96476d31609/size.c/buggy/c/src/tests/sptests/spsize/size.c
size_msgs_overhead = PER_MSG_OVERHEAD * maximum_msgs;
size_msgs_overhead = 0;
void help_size(){int c = '\0';int break_loop;int total_size;int task_stacks;int interrupt_stack;int maximum_tasks, size_tasks;int maximum_sems, size_sems;int maximum_timers, size_timers;int maximum_msgqs, size_msgqs;int maximum_msgs, size_msgs_overhead;int maximum_regns, size_regns;int maximum_parts, size_parts;int maximum_ports, size_ports;int maximum_periods, size_periods;int maximum_extensions, size_extensions;int maximum_drvs, size_drvs;int maximum_fps, size_fps;int maximum_nodes, size_nodes;int maximum_gobjs, size_gobjs;int maximum_proxies, size_proxies;total_size = sys_req; /* Fixed Overhead */printf( "What is maximum_tasks? " );maximum_tasks = getint();size_tasks = PER_TASK * maximum_tasks;total_size += size_tasks;printf( "What is maximum_semaphores? " );maximum_sems = getint();size_sems = PER_SEMAPHORE * maximum_sems;total_size += size_sems;printf( "What is maximum_timers? " );maximum_timers = getint();size_timers = PER_TIMER * maximum_timers;total_size += size_timers;printf( "What is maximum_message_queues? " );maximum_msgqs = getint();size_msgqs = PER_MSGQ * maximum_msgqs;total_size += size_msgqs;printf( "What is maximum_messages? " );maximum_msgs = getint();size_msgs_overhead = PER_MSG_OVERHEAD * maximum_msgs;total_size += size_msgs_overhead;printf( "What is maximum_regions? " );maximum_regns = getint();size_regns = PER_REGN * maximum_regns;total_size += size_regns;printf( "What is maximum_partitions? " );maximum_parts = getint();size_parts = PER_PART * maximum_parts;total_size += size_parts;printf( "What is maximum_ports? " );maximum_ports = getint();size_ports = PER_PORT * maximum_ports;total_size += size_ports;printf( "What is maximum_periods? " );maximum_periods = getint();size_periods = PER_PORT * maximum_periods;total_size += size_periods;printf( "What is maximum_extensions? " );maximum_extensions = getint();size_extensions = PER_EXTENSION * maximum_extensions;total_size += size_extensions;printf( "What is number_of_device_drivers? " );maximum_drvs = getint();size_drvs = PER_DRV * maximum_drvs;total_size += size_drvs;printf( "What will be total stack requirement for all tasks? " );task_stacks = getint();total_size += task_stacks;printf( "What is the size of the interrupt stack? " );interrupt_stack = getint();total_size += interrupt_stack;printf( "How many tasks will be created with the FP flag? " );maximum_fps = getint();size_fps = PER_FPTASK * maximum_fps;total_size += size_fps;printf( "Is this a single processor system? " );for ( break_loop=0 ; !break_loop; c = getchar() ) { switch ( c ) { case 'Y': case 'y': case 'N': case 'n': break_loop = 1; break; }}printf( "%c\n", c );if ( c == 'n' || c == 'N' ) { printf( "What is maximum_nodes? " ); maximum_nodes = getint(); size_nodes = PER_NODE * maximum_nodes; total_size += size_nodes; printf( "What is maximum_global_objects? " ); maximum_gobjs = getint(); size_gobjs = PER_GOBJECT * maximum_gobjs; total_size += size_gobjs; printf( "What is maximum_proxies? " ); maximum_proxies = getint(); size_proxies = PER_PROXY * maximum_proxies; total_size += size_proxies;} else { maximum_nodes = 0; size_nodes = PER_NODE * 0; maximum_gobjs = 0; size_gobjs = PER_GOBJECT * 0; maximum_proxies = 0; size_proxies = PER_PROXY * 0;}printf( "\n\n" );printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );printf( " Tasks - %03d * %03d = %d\n", maximum_tasks, PER_TASK, size_tasks );printf( " Semaphores - %03d * %03d = %d\n", maximum_sems, PER_SEMAPHORE, size_sems );printf( " Timers - %03d * %03d = %d\n", maximum_timers, PER_TIMER, size_timers );printf( " Msg Queues - %03d * %03d = %d\n", maximum_msgqs, PER_MSGQ, size_msgqs );printf( " Messages Overhead - %03d * %03d = %d\n", maximum_msgs, PER_MSG_OVERHEAD, size_msgs_overhead );printf( " Regions - %03d * %03d = %d\n", maximum_regns, PER_REGN, size_regns);printf( " Partitions - %03d * %03d = %d\n", maximum_parts, PER_PART, size_parts );printf( " Periods - %03d * %03d = %d\n", maximum_periods, PER_PERIOD, size_periods );printf( " Extensions - %03d * %03d = %d\n", maximum_extensions, PER_EXTENSION, size_extensions );printf( " Device Drivers - %03d * %03d = %d\n", maximum_drvs, PER_DRV, size_drvs );printf( " System Requirements - %04d = %d\n", sys_req, sys_req );printf( " Floating Point Tasks - %03d * %03d = %d\n", maximum_fps, PER_FPTASK, size_fps );printf( " Application Task Stacks - = %d\n", task_stacks );printf( " Interrupt Stacks - = %d\n", task_stacks );printf( " \n" );printf( " Global object tables - %03d * %03d = %d\n", maximum_nodes, PER_NODE, size_nodes );printf( " Global objects - %03d * %03d = %d\n", maximum_gobjs, PER_GOBJECT, size_gobjs );printf( " Proxies - %03d * %03d = %d\n", maximum_proxies, PER_PROXY, size_proxies );printf( "\n\n" );printf( " TOTAL = %d bytes\n", total_size );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3652ad356bf13abe0963c992cbbda96476d31609/size.c/buggy/c/src/tests/sptests/spsize/size.c
maximum_msgs, PER_MSG_OVERHEAD, size_msgs_overhead );
maximum_msgs, 0 /* PER_MSG_OVERHEAD */, size_msgs_overhead );
void help_size(){int c = '\0';int break_loop;int total_size;int task_stacks;int interrupt_stack;int maximum_tasks, size_tasks;int maximum_sems, size_sems;int maximum_timers, size_timers;int maximum_msgqs, size_msgqs;int maximum_msgs, size_msgs_overhead;int maximum_regns, size_regns;int maximum_parts, size_parts;int maximum_ports, size_ports;int maximum_periods, size_periods;int maximum_extensions, size_extensions;int maximum_drvs, size_drvs;int maximum_fps, size_fps;int maximum_nodes, size_nodes;int maximum_gobjs, size_gobjs;int maximum_proxies, size_proxies;total_size = sys_req; /* Fixed Overhead */printf( "What is maximum_tasks? " );maximum_tasks = getint();size_tasks = PER_TASK * maximum_tasks;total_size += size_tasks;printf( "What is maximum_semaphores? " );maximum_sems = getint();size_sems = PER_SEMAPHORE * maximum_sems;total_size += size_sems;printf( "What is maximum_timers? " );maximum_timers = getint();size_timers = PER_TIMER * maximum_timers;total_size += size_timers;printf( "What is maximum_message_queues? " );maximum_msgqs = getint();size_msgqs = PER_MSGQ * maximum_msgqs;total_size += size_msgqs;printf( "What is maximum_messages? " );maximum_msgs = getint();size_msgs_overhead = PER_MSG_OVERHEAD * maximum_msgs;total_size += size_msgs_overhead;printf( "What is maximum_regions? " );maximum_regns = getint();size_regns = PER_REGN * maximum_regns;total_size += size_regns;printf( "What is maximum_partitions? " );maximum_parts = getint();size_parts = PER_PART * maximum_parts;total_size += size_parts;printf( "What is maximum_ports? " );maximum_ports = getint();size_ports = PER_PORT * maximum_ports;total_size += size_ports;printf( "What is maximum_periods? " );maximum_periods = getint();size_periods = PER_PORT * maximum_periods;total_size += size_periods;printf( "What is maximum_extensions? " );maximum_extensions = getint();size_extensions = PER_EXTENSION * maximum_extensions;total_size += size_extensions;printf( "What is number_of_device_drivers? " );maximum_drvs = getint();size_drvs = PER_DRV * maximum_drvs;total_size += size_drvs;printf( "What will be total stack requirement for all tasks? " );task_stacks = getint();total_size += task_stacks;printf( "What is the size of the interrupt stack? " );interrupt_stack = getint();total_size += interrupt_stack;printf( "How many tasks will be created with the FP flag? " );maximum_fps = getint();size_fps = PER_FPTASK * maximum_fps;total_size += size_fps;printf( "Is this a single processor system? " );for ( break_loop=0 ; !break_loop; c = getchar() ) { switch ( c ) { case 'Y': case 'y': case 'N': case 'n': break_loop = 1; break; }}printf( "%c\n", c );if ( c == 'n' || c == 'N' ) { printf( "What is maximum_nodes? " ); maximum_nodes = getint(); size_nodes = PER_NODE * maximum_nodes; total_size += size_nodes; printf( "What is maximum_global_objects? " ); maximum_gobjs = getint(); size_gobjs = PER_GOBJECT * maximum_gobjs; total_size += size_gobjs; printf( "What is maximum_proxies? " ); maximum_proxies = getint(); size_proxies = PER_PROXY * maximum_proxies; total_size += size_proxies;} else { maximum_nodes = 0; size_nodes = PER_NODE * 0; maximum_gobjs = 0; size_gobjs = PER_GOBJECT * 0; maximum_proxies = 0; size_proxies = PER_PROXY * 0;}printf( "\n\n" );printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" );printf( " Tasks - %03d * %03d = %d\n", maximum_tasks, PER_TASK, size_tasks );printf( " Semaphores - %03d * %03d = %d\n", maximum_sems, PER_SEMAPHORE, size_sems );printf( " Timers - %03d * %03d = %d\n", maximum_timers, PER_TIMER, size_timers );printf( " Msg Queues - %03d * %03d = %d\n", maximum_msgqs, PER_MSGQ, size_msgqs );printf( " Messages Overhead - %03d * %03d = %d\n", maximum_msgs, PER_MSG_OVERHEAD, size_msgs_overhead );printf( " Regions - %03d * %03d = %d\n", maximum_regns, PER_REGN, size_regns);printf( " Partitions - %03d * %03d = %d\n", maximum_parts, PER_PART, size_parts );printf( " Periods - %03d * %03d = %d\n", maximum_periods, PER_PERIOD, size_periods );printf( " Extensions - %03d * %03d = %d\n", maximum_extensions, PER_EXTENSION, size_extensions );printf( " Device Drivers - %03d * %03d = %d\n", maximum_drvs, PER_DRV, size_drvs );printf( " System Requirements - %04d = %d\n", sys_req, sys_req );printf( " Floating Point Tasks - %03d * %03d = %d\n", maximum_fps, PER_FPTASK, size_fps );printf( " Application Task Stacks - = %d\n", task_stacks );printf( " Interrupt Stacks - = %d\n", task_stacks );printf( " \n" );printf( " Global object tables - %03d * %03d = %d\n", maximum_nodes, PER_NODE, size_nodes );printf( " Global objects - %03d * %03d = %d\n", maximum_gobjs, PER_GOBJECT, size_gobjs );printf( " Proxies - %03d * %03d = %d\n", maximum_proxies, PER_PROXY, size_proxies );printf( "\n\n" );printf( " TOTAL = %d bytes\n", total_size );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3652ad356bf13abe0963c992cbbda96476d31609/size.c/buggy/c/src/tests/sptests/spsize/size.c
long v = min(vn, vd); n = shiftpol_i(n, v); d = shiftpol_i(d, v); if (gcmp1(d)) d = NULL;
long v = min(vn, vd), dn = degpol(n); if (dn >= 0) { if (v > dn) v = dn; n = shiftpol_i(n, v); d = shiftpol_i(d, v); if (gcmp1(d)) d = NULL; }
gred_rfrac2_i(GEN n, GEN d){ GEN y, p1, cn, cd, c; long tx,ty; if (isexactzero(n)) return gcopy(n); n = simplify_i(n); tx = typ(n); d = simplify_i(d); ty = typ(d); if (ty!=t_POL) { if (tx!=t_POL) return gred_rfrac_copy(n,d); if (varncmp(gvar2(d), varn(n)) > 0) return gdiv(n,d); err(talker,"incompatible variables in gred"); } if (tx!=t_POL) { if (varncmp(varn(d), gvar2(n)) < 0) return gred_rfrac_simple(n,d); err(talker,"incompatible variables in gred"); } if (varncmp(varn(d), varn(n)) < 0) return gred_rfrac_simple(n,d); if (varncmp(varn(d), varn(n)) > 0) return gdiv(n,d); /* now n and d are polynomials with the same variable */ cd = content(d); if (!gcmp1(cd)) d = gdiv(d,cd); cn = content(n); if (gcmp0(cn)) { long vn, vd = polvaluation(d, NULL); if (vd) { vn = polvaluation(n, NULL); if (vn) { long v = min(vn, vd); n = shiftpol_i(n, v); d = shiftpol_i(d, v); if (gcmp1(d)) d = NULL; } } n = gdiv(n,cd); return d? gred_rfrac_copy(n, d): n; } if (!gcmp1(cn)) { n = gdiv(n,cn); c = gdiv(cn,cd); } else c = ginv(cd); y = RgX_divrem(n, d, &p1); if (!signe(p1)) return gmul(c,y); p1 = ggcd(d,p1); if (degpol(p1)) { n=gdeuc(n,p1); d=gdeuc(d,p1); } if (typ(c) == t_POL) { cd = denom(content(c)); cn = gmul(c, cd); } else { cn = numer(c); cd = denom(c); } p1 = cgetg(3,t_RFRAC); gel(p1,1) = gmul(n,cn); gel(p1,2) = gmul(d,cd); return p1;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/ad2ccef0820f736818bd56d5e00b007cd62258fe/gen1.c/buggy/src/basemath/gen1.c
{
ideal_two_elt(GEN nf, GEN x){ GEN z; long N, tx = idealtyp(&x,&z); nf = checknf(nf); if (tx == id_MAT) return mat_ideal_two_elt(nf,x); N = degpol(nf[1]); z = cgetg(3,t_VEC); if (tx == id_PRINCIPAL) { switch(typ(x)) { case t_INT: case t_FRAC: gel(z,1) = gcopy(x); gel(z,2) = zerocol(N); return z; case t_POLMOD: x = checknfelt_mod(nf, x, "ideal_two_elt"); /* fall through */ case t_POL: gel(z,1) = gen_0; gel(z,2) = algtobasis(nf,x); return z; case t_COL: if (lg(x)==N+1) { gel(z,1) = gen_0; gel(z,2) = gcopy(x); return z; } } } else if (tx == id_PRIME) { gel(z,1) = gcopy(gel(x,1)); gel(z,2) = gcopy(gel(x,2)); return z; } err(typeer,"ideal_two_elt"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/88a5ea098bd3f806f055886045cbd51a60cc0863/base4.c/clean/src/basemath/base4.c
} else if (tx == id_PRIME) { gel(z,1) = gcopy(gel(x,1)); gel(z,2) = gcopy(gel(x,2)); return z; }
ideal_two_elt(GEN nf, GEN x){ GEN z; long N, tx = idealtyp(&x,&z); nf = checknf(nf); if (tx == id_MAT) return mat_ideal_two_elt(nf,x); N = degpol(nf[1]); z = cgetg(3,t_VEC); if (tx == id_PRINCIPAL) { switch(typ(x)) { case t_INT: case t_FRAC: gel(z,1) = gcopy(x); gel(z,2) = zerocol(N); return z; case t_POLMOD: x = checknfelt_mod(nf, x, "ideal_two_elt"); /* fall through */ case t_POL: gel(z,1) = gen_0; gel(z,2) = algtobasis(nf,x); return z; case t_COL: if (lg(x)==N+1) { gel(z,1) = gen_0; gel(z,2) = gcopy(x); return z; } } } else if (tx == id_PRIME) { gel(z,1) = gcopy(gel(x,1)); gel(z,2) = gcopy(gel(x,2)); return z; } err(typeer,"ideal_two_elt"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/88a5ea098bd3f806f055886045cbd51a60cc0863/base4.c/clean/src/basemath/base4.c
if (lc && lfamod < 2*K) pol = QXQ_normalize(primpart(pol), nfpol);
nfcmbf(nfcmbf_t *T, GEN p, long a, long maxK, long klim){ long Sbound; GEN pol = T->pol, nf = T->nf, famod = T->fact; GEN dn = T->dn, bound = T->bound; GEN den = T->L->den, deno2 = shifti(den, -1); GEN nfpol = (GEN)nf[1]; long K = 1, cnt = 1, i,j,k, curdeg, lfamod = lg(famod)-1, dnf = degpol(nfpol); GEN lc, lcpol, h1 = NULL; /* gcc -Wall */ GEN pa = gpowgs(p,a), pas2 = shifti(pa,-1); GEN hS1 = cgetg(lfamod+1, t_VEC); GEN hS2 = cgetg(lfamod+1, t_VEC); GEN trace1 = cgetg(lfamod+1, t_MAT); GEN trace2 = cgetg(lfamod+1, t_MAT); GEN ind = cgetg(lfamod+1, t_VECSMALL); GEN degpol = cgetg(lfamod+1, t_VECSMALL); GEN degsofar = cgetg(lfamod+1, t_VECSMALL); GEN listmod = cgetg(lfamod+1, t_COL); GEN fa = cgetg(lfamod+1, t_COL); GEN res = cgetg(3, t_VEC); const double Blow = get_Blow((double)lfamod, (double)dnf); if (maxK < 0) maxK = lfamod-1; (void)dn; lc = absi(leading_term(pol)); if (gcmp1(lc)) lc = NULL; lcpol = lc? gmul(lc,pol): pol; { GEN T1,T2, q, goodq, lc2 = lc? sqri(lc): NULL; long e, e1, e2; q = ceil_safe(mpsqrt(T->BS_2)); for (i=1; i <= lfamod; i++) { GEN P = (GEN)famod[i]; long d = degpol(P); degpol[i] = d; P += 2; T1 = (GEN)P[d-1];/* = - S_1 */ T2 = sqri(T1); if (d > 1) T2 = subii(T2, shifti((GEN)P[d-2],1)); T2 = modii(T2, pa); /* = S_2 Newton sum */ if (lc) { T1 = modii(mulii(lc, T1), pa); T2 = modii(mulii(lc2,T2), pa); } trace1[i] = (long)nf_bestlift(T1, NULL, T->L); trace2[i] = (long)nf_bestlift(T2, NULL, T->L); } e1 = gexpo((GEN)trace1); e2 = gexpo((GEN)trace2); e = max(e1, e2); if (e < 0) /* trace1 = trace2 = 0 */ trace1 = trace2 = NULL; else { goodq = shifti(gun, e2 - 32); /* single precision check */ if (cmpii(goodq, q) > 0) q = goodq; T1 = trace1; T2 = trace2; trace1 = gdivround(T1, q); if (gcmp0(trace1)) trace1 = NULL; trace2 = gdivround(T2, q); if (gcmp0(trace2)) trace2 = NULL; if (trace1) hS1 = gsub(T1, gmul(T->L->prk, trace1)); if (trace2) hS2 = gsub(T2, gmul(T->L->prk, trace2)); /* <= q/2 */ h1 = gdivround(T->L->prk, q); } } degsofar[0] = 0; /* sentinel */ /* ind runs through strictly increasing sequences of length K, * 1 <= ind[i] <= lfamod */nextK: if (K > maxK || 2*K > lfamod) goto END; if (DEBUGLEVEL > 3) fprintferr("\n### K = %d, %Z combinations\n", K,binome(stoi(lfamod), K)); setlg(ind, K+1); ind[1] = 1; Sbound = ((K+1)>>1); i = 1; curdeg = degpol[ind[1]]; for(;;) { /* try all combinations of K factors */ for (j = i; j < K; j++) { degsofar[j] = curdeg; ind[j+1] = ind[j]+1; curdeg += degpol[ind[j+1]]; } if (curdeg <= klim && curdeg % T->hint == 0) /* trial divide */ { GEN s, t, y, q, list; gpmem_t av; av = avma; /* d - 1 test */ if (trace1) { s = (GEN)hS1[ind[1]]; t = (GEN)trace1[ind[1]]; for (i=2; i<=K; i++) { t = gadd(t, (GEN)trace1[ind[i]]); s = gadd(s, (GEN)hS1[ind[i]]); for (j=1; j<=dnf; j++) if (absi_cmp((GEN)s[i], deno2) > 0) { t = gsub(t, (GEN)h1[i]); s[i] = lsubii((GEN)s[i], den); } } if (rtodbl(QuickNormL2(t,DEFAULTPREC)) > Blow) { if (DEBUGLEVEL>6) fprintferr("."); avma = av; goto NEXT; } } /* d - 2 test */ if (trace2) { s = (GEN)hS2[ind[1]]; t = (GEN)trace2[ind[1]]; for (i=2; i<=K; i++) { t = gadd(t, (GEN)trace2[ind[i]]); s = gadd(s, (GEN)hS2[ind[i]]); for (j=1; j<=dnf; j++) if (absi_cmp((GEN)s[i], deno2) > 0) { t = gsub(t, (GEN)h1[i]); s[i] = lsubii((GEN)s[i], den); } } if (rtodbl(QuickNormL2(t,DEFAULTPREC)) > Blow) { if (DEBUGLEVEL>3) fprintferr("|"); avma = av; goto NEXT; } } avma = av; y = lc; /* full computation */ for (i=1; i<=K; i++) { GEN q = (GEN)famod[ind[i]]; if (y) q = gmul(y, q); y = centermod_i(q, pa, pas2); } y = nf_pol_lift(y, bound, T); if (!y) { if (DEBUGLEVEL>3) fprintferr("@"); avma = av; goto NEXT; } /* try out the new combination: y is the candidate factor */ q = RXQX_divrem(lcpol,y, nfpol, ONLY_DIVIDES); if (!q) { if (DEBUGLEVEL>3) fprintferr("*"); avma = av; goto NEXT; } /* found a factor */ list = cgetg(K+1, t_VEC); listmod[cnt] = (long)list; for (i=1; i<=K; i++) list[i] = famod[ind[i]]; y = primpart(y); fa[cnt++] = (long)QXQ_normalize(y, nfpol); /* fix up pol */ pol = q; if (lc) pol = primpart(pol); for (i=j=k=1; i <= lfamod; i++) { /* remove used factors */ if (j <= K && i == ind[j]) j++; else { famod[k] = famod[i]; if (trace1) { trace1[k] = trace1[i]; hS1[k] = hS2[i]; } if (trace2) { trace2[k] = trace2[i]; hS2[k] = hS2[i]; } degpol[k] = degpol[i]; k++; } } lfamod -= K; if (lfamod < 2*K) goto END; i = 1; curdeg = degpol[ind[1]]; if (lc) lc = absi(leading_term(pol)); lcpol = lc? gmul(lc,pol): pol; if (DEBUGLEVEL > 2) { fprintferr("\n"); msgtimer("to find factor %Z",y); fprintferr("remaining modular factor(s): %ld\n", lfamod); } continue; }NEXT: for (i = K+1;;) { if (--i == 0) { K++; goto nextK; } if (++ind[i] <= lfamod - K + i) { curdeg = degsofar[i-1] + degpol[ind[i]]; if (curdeg <= klim) break; } } }END: if (degpol(pol) > 0) { /* leftover factor */ if (signe(leading_term(pol)) < 0) pol = gneg_i(pol); setlg(famod, lfamod+1); listmod[cnt] = (long)dummycopy(famod); fa[cnt++] = (long)pol; } if (DEBUGLEVEL>6) fprintferr("\n"); setlg(listmod, cnt); setlg(fa, cnt); res[1] = (long)fa; res[2] = (long)listmod; return res;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/bb0c65bef80e147d3bcd0d500f98791a21064683/nffactor.c/buggy/src/modules/nffactor.c
if (address_space & VX_AM_SUP)
if ( VME_AM_IS_SUP(address_space) )
am2mode(int ismaster, unsigned long address_space, unsigned long *pmode){unsigned long mode=0; if (!ismaster) { mode |= UNIV_SCTL_DAT | UNIV_SCTL_PGM; mode |= UNIV_SCTL_USER; } switch (address_space) { case VME_AM_STD_SUP_PGM: case VME_AM_STD_USR_PGM: if (ismaster) mode |= UNIV_MCTL_PGM ; else { mode &= ~UNIV_SCTL_DAT; } /* fall thru */ case VME_AM_STD_SUP_DATA: case VME_AM_STD_USR_DATA: mode |= UNIV_CTL_VAS24; break; case VME_AM_EXT_SUP_PGM: case VME_AM_EXT_USR_PGM: if (ismaster) mode |= UNIV_MCTL_PGM ; else { mode &= ~UNIV_SCTL_DAT; } /* fall thru */ case VME_AM_EXT_SUP_DATA: case VME_AM_EXT_USR_DATA: mode |= UNIV_CTL_VAS32; break; case VME_AM_SUP_SHORT_IO: case VME_AM_USR_SHORT_IO: mode |= UNIV_CTL_VAS16; break; case 0: /* disable the port alltogether */ break; default: return -1; } if (address_space & VX_AM_SUP) mode |= (ismaster ? UNIV_MCTL_SUPER : UNIV_SCTL_SUPER); *pmode = mode; return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c
++_CPU_spurious_count; _CPU_last_spurious = v;
static void ppc_spurious(int v, CPU_Interrupt_frame *i){#if 0 printf("Spurious interrupt on vector %d from %08.8x\n", v, i->pc);#endif#ifdef ppc403 if (v == PPC_IRQ_EXTERNAL) { register int r = 0; asm volatile("mtdcr 0x42, %0" : "=&r" ((r)) : "0" ((r))); /* EXIER */ } else if (v == PPC_IRQ_PIT) { register int r = 0x08000000; asm volatile("mtspr 0x3d8, %0" : "=&r" ((r)) : "0" ((r))); /* TSR */ } else if (v == PPC_IRQ_FIT) { register int r = 0x04000000; asm volatile("mtspr 0x3d8, %0" : "=&r" ((r)) : "0" ((r))); /* TSR */ }#endif}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52/cpu.c/clean/c/src/lib/libcpu/powerpc/old_exception_processing/cpu.c
double x, logbinomial,pente, pentemax = -pariINFINITY; long n=degpol(p),i;
double x, logbinomial, mins = pariINFINITY; long n = degpol(p),i;
findpower(GEN p){ double x, logbinomial,pente, pentemax = -pariINFINITY; long n=degpol(p),i; logbinomial = mylog2((GEN)p[n+2]); /* log2(lc * binom(n,i)) */ for (i=n-1; i>=0; i--) { logbinomial += log2((double) (i+1) / (double) (n-i)); x = mylog2((GEN)p[i+2]); if (x != -pariINFINITY) { pente = (x - logbinomial) / (double) (n-i); if (pente > pentemax) pentemax = pente; } } return (long) -floor(pentemax);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9259d1de2aba7aabcb6454d7a3c23cda32ebea63/rootpol.c/buggy/src/basemath/rootpol.c
pente = (x - logbinomial) / (double) (n-i); if (pente > pentemax) pentemax = pente;
double s = (logbinomial - x) / (double) (n-i); if (s < mins) mins = s;
findpower(GEN p){ double x, logbinomial,pente, pentemax = -pariINFINITY; long n=degpol(p),i; logbinomial = mylog2((GEN)p[n+2]); /* log2(lc * binom(n,i)) */ for (i=n-1; i>=0; i--) { logbinomial += log2((double) (i+1) / (double) (n-i)); x = mylog2((GEN)p[i+2]); if (x != -pariINFINITY) { pente = (x - logbinomial) / (double) (n-i); if (pente > pentemax) pentemax = pente; } } return (long) -floor(pentemax);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9259d1de2aba7aabcb6454d7a3c23cda32ebea63/rootpol.c/buggy/src/basemath/rootpol.c
return (long) -floor(pentemax);
return (long)ceil(mins);
findpower(GEN p){ double x, logbinomial,pente, pentemax = -pariINFINITY; long n=degpol(p),i; logbinomial = mylog2((GEN)p[n+2]); /* log2(lc * binom(n,i)) */ for (i=n-1; i>=0; i--) { logbinomial += log2((double) (i+1) / (double) (n-i)); x = mylog2((GEN)p[i+2]); if (x != -pariINFINITY) { pente = (x - logbinomial) / (double) (n-i); if (pente > pentemax) pentemax = pente; } } return (long) -floor(pentemax);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/9259d1de2aba7aabcb6454d7a3c23cda32ebea63/rootpol.c/buggy/src/basemath/rootpol.c
unsigned32 count
uint32_t count
ssize_t device_write( rtems_libio_t *iop, const void *buffer, unsigned32 count){ rtems_libio_rw_args_t args; rtems_status_code status; IMFS_jnode_t *the_jnode; the_jnode = iop->file_info; args.iop = iop; args.offset = iop->offset; args.buffer = (void *) buffer; args.count = count; args.flags = iop->flags; args.bytes_moved = 0; status = rtems_io_write( the_jnode->info.device.major, the_jnode->info.device.minor, (void *) &args ); if ( status ) return rtems_deviceio_errno(status); return (ssize_t) args.bytes_moved;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f91bbe6412aae92765ce43b22f4eef9f516a7289/deviceio.c/clean/cpukit/libfs/src/imfs/deviceio.c
long tx=typ(x),lx,i,e;
long tx=typ(x),lx,i,e = gexpo(x);
mygprec(GEN x, long bitprec){ long tx=typ(x),lx,i,e; GEN y; switch(tx) { case t_POL: lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; e=gexpo(x); for (i=2; i<lx; i++) y[i]=(long) mygprecrc((GEN)x[i],bitprec,e); break; default: y=mygprecrc(x,bitprec,0); } return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/3760d68b160c7b3a0764d6638cf6744887f1ac26/rootpol.c/clean/src/basemath/rootpol.c
lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; e=gexpo(x);
lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1];
mygprec(GEN x, long bitprec){ long tx=typ(x),lx,i,e; GEN y; switch(tx) { case t_POL: lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; e=gexpo(x); for (i=2; i<lx; i++) y[i]=(long) mygprecrc((GEN)x[i],bitprec,e); break; default: y=mygprecrc(x,bitprec,0); } return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/3760d68b160c7b3a0764d6638cf6744887f1ac26/rootpol.c/clean/src/basemath/rootpol.c
default: y=mygprecrc(x,bitprec,0);
default: y=mygprecrc(x,bitprec,e);
mygprec(GEN x, long bitprec){ long tx=typ(x),lx,i,e; GEN y; switch(tx) { case t_POL: lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; e=gexpo(x); for (i=2; i<lx; i++) y[i]=(long) mygprecrc((GEN)x[i],bitprec,e); break; default: y=mygprecrc(x,bitprec,0); } return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/3760d68b160c7b3a0764d6638cf6744887f1ac26/rootpol.c/clean/src/basemath/rootpol.c
GEN p1, v, rlog, logunit, y, ex, nf, z, pi2_sur_w, gn, emb;
GEN p1, v, rlog, logunit, ex, nf, z, pi2_sur_w, gn, emb;
isunit(GEN bnf,GEN x){ long tx = typ(x), i, R1, RU, n, prec; gpmem_t av = avma; GEN p1, v, rlog, logunit, y, ex, nf, z, pi2_sur_w, gn, emb; bnf = checkbnf(bnf); nf=(GEN)bnf[7]; logunit = (GEN)bnf[3]; RU = lg(logunit); p1 = gmael(bnf,8,4); /* roots of 1 */ gn = (GEN)p1[1]; n = itos(gn); z = algtobasis(nf, (GEN)p1[2]); switch(tx) { case t_INT: case t_FRAC: case t_FRACN: if (!gcmp1(x) && !gcmp_1(x)) return cgetg(1,t_COL); y = zerocol(RU); i = (gsigne(x) > 0)? 0: n>>1; y[RU] = (long)gmodulss(i, n); return y; case t_MAT: /* famat */ if (lg(x) != 3 || lg(x[1]) != lg(x[2])) err(talker, "not a factorization matrix in isunit"); break; case t_COL: if (degpol(nf[1]) != lg(x)-1) err(talker,"not an algebraic number in isunit"); break; default: x = algtobasis(nf, x); break; } /* assume a famat is integral */ if (tx != t_MAT && !gcmp1(denom(x))) { avma = av; return cgetg(1,t_COL); } R1 = nf_get_r1(nf); v = cgetg(RU+1,t_COL); for (i=1; i<=R1; i++) v[i] = un; for ( ; i<=RU; i++) v[i] = deux; logunit = concatsp(logunit, v); /* ex = fundamental units exponents */ rlog = greal(logunit); prec = nfgetprec(nf); for (i=1;;) { GEN logN, rx = get_arch_real(nf,x,&emb, MEDDEFAULTPREC); long e; if (rx) { logN = sum(rx, 1, RU); /* log(Nx), should be ~ 0 */ if (gexpo(logN) > -20) { long p = 2 + max(1, (nfgetprec(nf)-2) / 2); if (typ(logN) != t_REAL || gprecision(rx) > p) { avma = av; return cgetg(1,t_COL); } /* not a precision problem */ rx = NULL; } } if (rx) { ex = grndtoi(gauss(rlog, rx), &e); if (gcmp0((GEN)ex[RU]) && e < -4) break; } if (++i > 4) err(precer,"isunit"); prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"isunit",prec); nf = nfnewprec(nf, prec); } setlg(ex, RU); p1 = row_i(logunit,1, 1,RU); p1 = gneg(gimag(gmul(p1,ex))); if (!R1) p1 = gmul2n(p1, -1); p1 = gadd(garg((GEN)emb[1],prec), p1); /* p1 = arg(the missing root of 1) */ pi2_sur_w = divrs(mppi(prec), n>>1); /* 2pi / n */ p1 = ground(gdiv(p1, pi2_sur_w)); if (n > 2) { GEN ro = gmul(row(gmael(nf,5,1), 1), z); GEN p2 = ground(gdiv(garg(ro, prec), pi2_sur_w)); p1 = mulii(p1, mpinvmod(p2, gn)); } ex[RU] = lmodulcp(p1, gn); setlg(ex, RU+1); return gerepilecopy(av, ex);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b8f7b3acc3955ff31c4ed1a197e5acaa057a5e98/buch2.c/buggy/src/basemath/buch2.c
if (!gcmp1(x) && !gcmp_1(x)) return cgetg(1,t_COL); y = zerocol(RU); i = (gsigne(x) > 0)? 0: n>>1; y[RU] = (long)gmodulss(i, n); return y;
return rational_unit(x, n, RU);
isunit(GEN bnf,GEN x){ long tx = typ(x), i, R1, RU, n, prec; gpmem_t av = avma; GEN p1, v, rlog, logunit, y, ex, nf, z, pi2_sur_w, gn, emb; bnf = checkbnf(bnf); nf=(GEN)bnf[7]; logunit = (GEN)bnf[3]; RU = lg(logunit); p1 = gmael(bnf,8,4); /* roots of 1 */ gn = (GEN)p1[1]; n = itos(gn); z = algtobasis(nf, (GEN)p1[2]); switch(tx) { case t_INT: case t_FRAC: case t_FRACN: if (!gcmp1(x) && !gcmp_1(x)) return cgetg(1,t_COL); y = zerocol(RU); i = (gsigne(x) > 0)? 0: n>>1; y[RU] = (long)gmodulss(i, n); return y; case t_MAT: /* famat */ if (lg(x) != 3 || lg(x[1]) != lg(x[2])) err(talker, "not a factorization matrix in isunit"); break; case t_COL: if (degpol(nf[1]) != lg(x)-1) err(talker,"not an algebraic number in isunit"); break; default: x = algtobasis(nf, x); break; } /* assume a famat is integral */ if (tx != t_MAT && !gcmp1(denom(x))) { avma = av; return cgetg(1,t_COL); } R1 = nf_get_r1(nf); v = cgetg(RU+1,t_COL); for (i=1; i<=R1; i++) v[i] = un; for ( ; i<=RU; i++) v[i] = deux; logunit = concatsp(logunit, v); /* ex = fundamental units exponents */ rlog = greal(logunit); prec = nfgetprec(nf); for (i=1;;) { GEN logN, rx = get_arch_real(nf,x,&emb, MEDDEFAULTPREC); long e; if (rx) { logN = sum(rx, 1, RU); /* log(Nx), should be ~ 0 */ if (gexpo(logN) > -20) { long p = 2 + max(1, (nfgetprec(nf)-2) / 2); if (typ(logN) != t_REAL || gprecision(rx) > p) { avma = av; return cgetg(1,t_COL); } /* not a precision problem */ rx = NULL; } } if (rx) { ex = grndtoi(gauss(rlog, rx), &e); if (gcmp0((GEN)ex[RU]) && e < -4) break; } if (++i > 4) err(precer,"isunit"); prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"isunit",prec); nf = nfnewprec(nf, prec); } setlg(ex, RU); p1 = row_i(logunit,1, 1,RU); p1 = gneg(gimag(gmul(p1,ex))); if (!R1) p1 = gmul2n(p1, -1); p1 = gadd(garg((GEN)emb[1],prec), p1); /* p1 = arg(the missing root of 1) */ pi2_sur_w = divrs(mppi(prec), n>>1); /* 2pi / n */ p1 = ground(gdiv(p1, pi2_sur_w)); if (n > 2) { GEN ro = gmul(row(gmael(nf,5,1), 1), z); GEN p2 = ground(gdiv(garg(ro, prec), pi2_sur_w)); p1 = mulii(p1, mpinvmod(p2, gn)); } ex[RU] = lmodulcp(p1, gn); setlg(ex, RU+1); return gerepilecopy(av, ex);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b8f7b3acc3955ff31c4ed1a197e5acaa057a5e98/buch2.c/buggy/src/basemath/buch2.c
if (isnfscalar(x)) return gerepileupto(av, rational_unit((GEN)x[1],n,RU));
isunit(GEN bnf,GEN x){ long tx = typ(x), i, R1, RU, n, prec; gpmem_t av = avma; GEN p1, v, rlog, logunit, y, ex, nf, z, pi2_sur_w, gn, emb; bnf = checkbnf(bnf); nf=(GEN)bnf[7]; logunit = (GEN)bnf[3]; RU = lg(logunit); p1 = gmael(bnf,8,4); /* roots of 1 */ gn = (GEN)p1[1]; n = itos(gn); z = algtobasis(nf, (GEN)p1[2]); switch(tx) { case t_INT: case t_FRAC: case t_FRACN: if (!gcmp1(x) && !gcmp_1(x)) return cgetg(1,t_COL); y = zerocol(RU); i = (gsigne(x) > 0)? 0: n>>1; y[RU] = (long)gmodulss(i, n); return y; case t_MAT: /* famat */ if (lg(x) != 3 || lg(x[1]) != lg(x[2])) err(talker, "not a factorization matrix in isunit"); break; case t_COL: if (degpol(nf[1]) != lg(x)-1) err(talker,"not an algebraic number in isunit"); break; default: x = algtobasis(nf, x); break; } /* assume a famat is integral */ if (tx != t_MAT && !gcmp1(denom(x))) { avma = av; return cgetg(1,t_COL); } R1 = nf_get_r1(nf); v = cgetg(RU+1,t_COL); for (i=1; i<=R1; i++) v[i] = un; for ( ; i<=RU; i++) v[i] = deux; logunit = concatsp(logunit, v); /* ex = fundamental units exponents */ rlog = greal(logunit); prec = nfgetprec(nf); for (i=1;;) { GEN logN, rx = get_arch_real(nf,x,&emb, MEDDEFAULTPREC); long e; if (rx) { logN = sum(rx, 1, RU); /* log(Nx), should be ~ 0 */ if (gexpo(logN) > -20) { long p = 2 + max(1, (nfgetprec(nf)-2) / 2); if (typ(logN) != t_REAL || gprecision(rx) > p) { avma = av; return cgetg(1,t_COL); } /* not a precision problem */ rx = NULL; } } if (rx) { ex = grndtoi(gauss(rlog, rx), &e); if (gcmp0((GEN)ex[RU]) && e < -4) break; } if (++i > 4) err(precer,"isunit"); prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"isunit",prec); nf = nfnewprec(nf, prec); } setlg(ex, RU); p1 = row_i(logunit,1, 1,RU); p1 = gneg(gimag(gmul(p1,ex))); if (!R1) p1 = gmul2n(p1, -1); p1 = gadd(garg((GEN)emb[1],prec), p1); /* p1 = arg(the missing root of 1) */ pi2_sur_w = divrs(mppi(prec), n>>1); /* 2pi / n */ p1 = ground(gdiv(p1, pi2_sur_w)); if (n > 2) { GEN ro = gmul(row(gmael(nf,5,1), 1), z); GEN p2 = ground(gdiv(garg(ro, prec), pi2_sur_w)); p1 = mulii(p1, mpinvmod(p2, gn)); } ex[RU] = lmodulcp(p1, gn); setlg(ex, RU+1); return gerepilecopy(av, ex);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b8f7b3acc3955ff31c4ed1a197e5acaa057a5e98/buch2.c/buggy/src/basemath/buch2.c
return (block_p *)&p[ singly ];
return (block_p *)&p1[ singly ];
block_p *IMFS_memfile_get_block_pointer( IMFS_jnode_t *the_jnode, unsigned int block, int malloc_it){ unsigned int my_block; IMFS_memfile_t *info; unsigned int singly; unsigned int doubly; unsigned int triply; block_p *p; block_p *p1; block_p *p2; /* * Perform internal consistency checks */ assert( the_jnode ); if ( !the_jnode ) return NULL; assert( the_jnode->type == IMFS_MEMORY_FILE ); if ( the_jnode->type != IMFS_MEMORY_FILE ) return NULL; info = &the_jnode->info.file; my_block = block; /* * Is the block number in the simple indirect portion? */ if ( my_block <= LAST_INDIRECT ) {#if 0printf( "(s %d) ", block );fflush(stdout);#endif p = info->indirect; if ( malloc_it ) { if ( !p ) { p = memfile_alloc_block(); if ( !p ) return 0; info->indirect = p; } return &info->indirect[ my_block ]; } if ( !p ) return 0; return &info->indirect[ my_block ]; } /* * Is the block number in the doubly indirect portion? */ if ( my_block <= LAST_DOUBLY_INDIRECT ) {#if 0printf( "(d %d) ", block );fflush(stdout);#endif my_block -= FIRST_DOUBLY_INDIRECT; singly = my_block % IMFS_MEMFILE_BLOCK_SLOTS; doubly = my_block / IMFS_MEMFILE_BLOCK_SLOTS; p = info->doubly_indirect; if ( malloc_it ) { if ( !p ) { p = memfile_alloc_block(); if ( !p ) return 0; info->doubly_indirect = p; } p1 = (block_p *)p[ doubly ]; if ( !p1 ) { p1 = memfile_alloc_block(); if ( !p1 ) return 0; p[ doubly ] = (block_p) p1; } return (block_p *)&p[ singly ]; } if ( !p ) return 0; p = (block_p *)p[ doubly ]; if ( !p ) return 0;#if 0printf( "(d %d %d %d %d %p %p) ", block, my_block, doubly, singly, p, &p[singly] );fflush(stdout);#endif return (block_p *)&p[ singly ]; }#if 0printf( "(t %d) ", block );fflush(stdout);#endif /* * Is the block number in the triply indirect portion? */ if ( my_block <= LAST_TRIPLY_INDIRECT ) { my_block -= FIRST_TRIPLY_INDIRECT; singly = my_block % IMFS_MEMFILE_BLOCK_SLOTS; doubly = my_block / IMFS_MEMFILE_BLOCK_SLOTS; triply = doubly / IMFS_MEMFILE_BLOCK_SLOTS; doubly %= IMFS_MEMFILE_BLOCK_SLOTS; p = info->triply_indirect; if ( malloc_it ) { if ( !p ) { p = memfile_alloc_block(); if ( !p ) return 0; info->triply_indirect = p; } p1 = (block_p *) p[ triply ]; if ( !p1 ) { p1 = memfile_alloc_block(); if ( !p1 ) return 0; p[ triply ] = (block_p) p1; } p2 = (block_p *)p1[ doubly ]; if ( !p2 ) { p2 = memfile_alloc_block(); if ( !p2 ) return 0; p1[ doubly ] = (block_p) p2; } return (block_p *)&p2[ singly ]; } if ( !p ) return 0;#if 0printf( "(t %d %d %d %d %d) ", block, my_block, triply, doubly, singly );fflush(stdout);#endif p1 = (block_p *) p[ triply ]; if ( !p1 ) return 0; p2 = (block_p *)p1[ doubly ]; if ( !p ) return 0; return (block_p *)&p2[ singly ]; } /* * This means the requested block number is out of range. */ return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/b10f6e12e00caba93e56976cdef7b6326bc3af3e/memfile.c/buggy/c/src/libfs/src/imfs/memfile.c
int j, ph = lg(w);
long j, ph = lg(w);
_powpolmodsimple(Cache *C, Red *R, GEN jac){ GEN w = mulmat_pol(C->matvite, jac); int j, ph = lg(w); R->red = &_redsimple; for (j=1; j<ph; j++) w[j] = (long)_powpolmod(C, centermodii((GEN)w[j], R->N, R->N2), R, &sqrmod); w = centermod_i( gmul(C->matinvvite, w), R->N, R->N2 ); return RgV_to_RgX(w, 0);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c
long av=avma,tetpil,i,lx,tx;
ulong av = avma; long i,lx,tx;
rnfelementdown(GEN rnf,GEN x){ long av=avma,tetpil,i,lx,tx; GEN p1,z; checkrnf(rnf); tx=typ(x); lx=lg(x); switch(tx) { case t_VEC: case t_COL: case t_MAT: z=cgetg(lx,tx); for (i=1; i<lx; i++) z[i]=(long)rnfelementdown(rnf,(GEN)x[i]); return z; case t_POLMOD: x=(GEN)x[2]; /* fall through */ case t_POL: if (gcmp0(x)) return gzero; p1=rnfelementabstorel(rnf,x); if (typ(p1)==t_POLMOD && varn(p1[1])==varn(rnf[1])) p1=(GEN)p1[2]; if (gvar(p1)>varn(rnf[1])) { tetpil=avma; return gerepile(av,tetpil,gcopy(p1)); } if (lgef(p1)==3) { tetpil=avma; return gerepile(av,tetpil,gcopy((GEN)p1[2])); } err(talker,"element is not in the base field in rnfelementdown"); default: return gcopy(x); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base5.c/clean/src/basemath/base5.c
if (gvar(p1)>varn(rnf[1])) { tetpil=avma; return gerepile(av,tetpil,gcopy(p1)); } if (lgef(p1)==3) { tetpil=avma; return gerepile(av,tetpil,gcopy((GEN)p1[2])); }
if (gvar(p1)>varn(rnf[1])) return gerepilecopy(av,p1); if (lgef(p1)==3) return gerepilecopy(av,(GEN)p1[2]);
rnfelementdown(GEN rnf,GEN x){ long av=avma,tetpil,i,lx,tx; GEN p1,z; checkrnf(rnf); tx=typ(x); lx=lg(x); switch(tx) { case t_VEC: case t_COL: case t_MAT: z=cgetg(lx,tx); for (i=1; i<lx; i++) z[i]=(long)rnfelementdown(rnf,(GEN)x[i]); return z; case t_POLMOD: x=(GEN)x[2]; /* fall through */ case t_POL: if (gcmp0(x)) return gzero; p1=rnfelementabstorel(rnf,x); if (typ(p1)==t_POLMOD && varn(p1[1])==varn(rnf[1])) p1=(GEN)p1[2]; if (gvar(p1)>varn(rnf[1])) { tetpil=avma; return gerepile(av,tetpil,gcopy(p1)); } if (lgef(p1)==3) { tetpil=avma; return gerepile(av,tetpil,gcopy((GEN)p1[2])); } err(talker,"element is not in the base field in rnfelementdown"); default: return gcopy(x); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base5.c/clean/src/basemath/base5.c
bd=gmulsg(k,glog(gmael3(bnr,1,7,3),DEFAULTPREC));
bd=gmulsg(k,glog(mpabs(gmael3(bnr,1,7,3)),DEFAULTPREC));
rnfnormgroup0(GEN bnr, GEN polrel, GEN rnf){ long av=avma,i,j,reldeg,sizemat,prime,nfac,k; GEN bnf,polreldisc,nf,raycl,group,detgroup,fa,pr; GEN reldisc,famo,ep,fac,col,p1,bd,upnf; byteptr d = diffptr; checkbnr(bnr); bnf=(GEN)bnr[1]; raycl=(GEN)bnr[5]; nf=(GEN)bnf[7]; polrel = fix_relative_pol(nf,polrel); if (typ(polrel)!=t_POL) err(typeer,"rnfnormgroup"); reldeg=lgef(polrel)-3; detgroup=(GEN)raycl[1]; group = diagonal((GEN)raycl[2]); k = cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup?"); if (!rnf && !k) return group; polreldisc=discsr(polrel); if (rnf) { reldisc=gmael(rnf,3,1); upnf=nfinit0(gmael(rnf,11,1),1,DEFAULTPREC); } else { reldisc = idealhermite(nf,polreldisc); upnf = NULL; } k=degree(gmael3(bnr,1,7,1)); bd=gmulsg(k,glog(gmael3(bnr,1,7,3),DEFAULTPREC)); bd=gadd(bd,glog(mpabs(det(reldisc)),DEFAULTPREC)); k=reldeg*k;p1=gaddgs(gmulsg(k,dbltor(2.5)),5); bd=gfloor(gsqr(gadd(gmulsg(4,bd),p1))); if (rnf && DEBUGLEVEL) fprintferr("rnfnormgroup: bound for primes = %Z\n", bd); sizemat=lg(group)-1; prime = 0; for(;;) { prime += *d++; if (!*d) err(primer1); if (cmpis(bd,prime) <= 0) break; fa=primedec(nf,stoi(prime)); for (i=1; i<lg(fa); i++) { pr = (GEN)fa[i]; if (idealval(nf,reldisc,pr)==0) { if (element_val(nf,polreldisc,pr) == 0) { famo=nffactormod(nf,polrel,pr); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=lgef((GEN)fac[1])-3; for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (lgef(fac[j])-3 != k) err(talker,"non Galois extension in rnfnormgroup"); } } else { famo=idealfactor(upnf,rnfidealup(rnf,pr)); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=itos(gmael(fac,1,4)); for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (cmpis(gmael(fac,j,4),k)) err(talker,"non Galois extension in rnfnormgroup"); } } col=gmulsg(k,isprincipalrayall(bnr,pr,nf_REGULAR)); p1=cgetg(sizemat+2,t_MAT); for (j=1; j<=sizemat; j++) p1[j]=group[j]; p1[sizemat+1]=(long)col; group=hnf(p1); detgroup=dethnf(group); k=cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup"); if (!rnf && !k) { cgiv(detgroup); return gerepileupto(av,group); } } } } if (k>0) err(bugparier,"rnfnormgroup"); cgiv(detgroup); return gerepileupto(av,group);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/275f4667f70a314841e502489753d9e76fa02c47/buch3.c/clean/src/basemath/buch3.c
err(talker,"non Galois extension in rnfnormgroup");
{ if (rnf) return NULL; else err(talker,"non Galois extension in rnfnormgroup"); }
rnfnormgroup0(GEN bnr, GEN polrel, GEN rnf){ long av=avma,i,j,reldeg,sizemat,prime,nfac,k; GEN bnf,polreldisc,nf,raycl,group,detgroup,fa,pr; GEN reldisc,famo,ep,fac,col,p1,bd,upnf; byteptr d = diffptr; checkbnr(bnr); bnf=(GEN)bnr[1]; raycl=(GEN)bnr[5]; nf=(GEN)bnf[7]; polrel = fix_relative_pol(nf,polrel); if (typ(polrel)!=t_POL) err(typeer,"rnfnormgroup"); reldeg=lgef(polrel)-3; detgroup=(GEN)raycl[1]; group = diagonal((GEN)raycl[2]); k = cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup?"); if (!rnf && !k) return group; polreldisc=discsr(polrel); if (rnf) { reldisc=gmael(rnf,3,1); upnf=nfinit0(gmael(rnf,11,1),1,DEFAULTPREC); } else { reldisc = idealhermite(nf,polreldisc); upnf = NULL; } k=degree(gmael3(bnr,1,7,1)); bd=gmulsg(k,glog(gmael3(bnr,1,7,3),DEFAULTPREC)); bd=gadd(bd,glog(mpabs(det(reldisc)),DEFAULTPREC)); k=reldeg*k;p1=gaddgs(gmulsg(k,dbltor(2.5)),5); bd=gfloor(gsqr(gadd(gmulsg(4,bd),p1))); if (rnf && DEBUGLEVEL) fprintferr("rnfnormgroup: bound for primes = %Z\n", bd); sizemat=lg(group)-1; prime = 0; for(;;) { prime += *d++; if (!*d) err(primer1); if (cmpis(bd,prime) <= 0) break; fa=primedec(nf,stoi(prime)); for (i=1; i<lg(fa); i++) { pr = (GEN)fa[i]; if (idealval(nf,reldisc,pr)==0) { if (element_val(nf,polreldisc,pr) == 0) { famo=nffactormod(nf,polrel,pr); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=lgef((GEN)fac[1])-3; for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (lgef(fac[j])-3 != k) err(talker,"non Galois extension in rnfnormgroup"); } } else { famo=idealfactor(upnf,rnfidealup(rnf,pr)); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=itos(gmael(fac,1,4)); for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (cmpis(gmael(fac,j,4),k)) err(talker,"non Galois extension in rnfnormgroup"); } } col=gmulsg(k,isprincipalrayall(bnr,pr,nf_REGULAR)); p1=cgetg(sizemat+2,t_MAT); for (j=1; j<=sizemat; j++) p1[j]=group[j]; p1[sizemat+1]=(long)col; group=hnf(p1); detgroup=dethnf(group); k=cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup"); if (!rnf && !k) { cgiv(detgroup); return gerepileupto(av,group); } } } } if (k>0) err(bugparier,"rnfnormgroup"); cgiv(detgroup); return gerepileupto(av,group);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/275f4667f70a314841e502489753d9e76fa02c47/buch3.c/clean/src/basemath/buch3.c
err(talker,"non Galois extension in rnfnormgroup");
{ if(rnf) return NULL; else err(talker,"non Galois extension in rnfnormgroup"); }
rnfnormgroup0(GEN bnr, GEN polrel, GEN rnf){ long av=avma,i,j,reldeg,sizemat,prime,nfac,k; GEN bnf,polreldisc,nf,raycl,group,detgroup,fa,pr; GEN reldisc,famo,ep,fac,col,p1,bd,upnf; byteptr d = diffptr; checkbnr(bnr); bnf=(GEN)bnr[1]; raycl=(GEN)bnr[5]; nf=(GEN)bnf[7]; polrel = fix_relative_pol(nf,polrel); if (typ(polrel)!=t_POL) err(typeer,"rnfnormgroup"); reldeg=lgef(polrel)-3; detgroup=(GEN)raycl[1]; group = diagonal((GEN)raycl[2]); k = cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup?"); if (!rnf && !k) return group; polreldisc=discsr(polrel); if (rnf) { reldisc=gmael(rnf,3,1); upnf=nfinit0(gmael(rnf,11,1),1,DEFAULTPREC); } else { reldisc = idealhermite(nf,polreldisc); upnf = NULL; } k=degree(gmael3(bnr,1,7,1)); bd=gmulsg(k,glog(gmael3(bnr,1,7,3),DEFAULTPREC)); bd=gadd(bd,glog(mpabs(det(reldisc)),DEFAULTPREC)); k=reldeg*k;p1=gaddgs(gmulsg(k,dbltor(2.5)),5); bd=gfloor(gsqr(gadd(gmulsg(4,bd),p1))); if (rnf && DEBUGLEVEL) fprintferr("rnfnormgroup: bound for primes = %Z\n", bd); sizemat=lg(group)-1; prime = 0; for(;;) { prime += *d++; if (!*d) err(primer1); if (cmpis(bd,prime) <= 0) break; fa=primedec(nf,stoi(prime)); for (i=1; i<lg(fa); i++) { pr = (GEN)fa[i]; if (idealval(nf,reldisc,pr)==0) { if (element_val(nf,polreldisc,pr) == 0) { famo=nffactormod(nf,polrel,pr); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=lgef((GEN)fac[1])-3; for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (lgef(fac[j])-3 != k) err(talker,"non Galois extension in rnfnormgroup"); } } else { famo=idealfactor(upnf,rnfidealup(rnf,pr)); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=itos(gmael(fac,1,4)); for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (cmpis(gmael(fac,j,4),k)) err(talker,"non Galois extension in rnfnormgroup"); } } col=gmulsg(k,isprincipalrayall(bnr,pr,nf_REGULAR)); p1=cgetg(sizemat+2,t_MAT); for (j=1; j<=sizemat; j++) p1[j]=group[j]; p1[sizemat+1]=(long)col; group=hnf(p1); detgroup=dethnf(group); k=cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup"); if (!rnf && !k) { cgiv(detgroup); return gerepileupto(av,group); } } } } if (k>0) err(bugparier,"rnfnormgroup"); cgiv(detgroup); return gerepileupto(av,group);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/275f4667f70a314841e502489753d9e76fa02c47/buch3.c/clean/src/basemath/buch3.c
if (k<0) err(talker,"not an Abelian extension in rnfnormgroup");
if (k<0) { if (rnf) return NULL; else err(talker,"not an Abelian extension in rnfnormgroup"); }
rnfnormgroup0(GEN bnr, GEN polrel, GEN rnf){ long av=avma,i,j,reldeg,sizemat,prime,nfac,k; GEN bnf,polreldisc,nf,raycl,group,detgroup,fa,pr; GEN reldisc,famo,ep,fac,col,p1,bd,upnf; byteptr d = diffptr; checkbnr(bnr); bnf=(GEN)bnr[1]; raycl=(GEN)bnr[5]; nf=(GEN)bnf[7]; polrel = fix_relative_pol(nf,polrel); if (typ(polrel)!=t_POL) err(typeer,"rnfnormgroup"); reldeg=lgef(polrel)-3; detgroup=(GEN)raycl[1]; group = diagonal((GEN)raycl[2]); k = cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup?"); if (!rnf && !k) return group; polreldisc=discsr(polrel); if (rnf) { reldisc=gmael(rnf,3,1); upnf=nfinit0(gmael(rnf,11,1),1,DEFAULTPREC); } else { reldisc = idealhermite(nf,polreldisc); upnf = NULL; } k=degree(gmael3(bnr,1,7,1)); bd=gmulsg(k,glog(gmael3(bnr,1,7,3),DEFAULTPREC)); bd=gadd(bd,glog(mpabs(det(reldisc)),DEFAULTPREC)); k=reldeg*k;p1=gaddgs(gmulsg(k,dbltor(2.5)),5); bd=gfloor(gsqr(gadd(gmulsg(4,bd),p1))); if (rnf && DEBUGLEVEL) fprintferr("rnfnormgroup: bound for primes = %Z\n", bd); sizemat=lg(group)-1; prime = 0; for(;;) { prime += *d++; if (!*d) err(primer1); if (cmpis(bd,prime) <= 0) break; fa=primedec(nf,stoi(prime)); for (i=1; i<lg(fa); i++) { pr = (GEN)fa[i]; if (idealval(nf,reldisc,pr)==0) { if (element_val(nf,polreldisc,pr) == 0) { famo=nffactormod(nf,polrel,pr); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=lgef((GEN)fac[1])-3; for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (lgef(fac[j])-3 != k) err(talker,"non Galois extension in rnfnormgroup"); } } else { famo=idealfactor(upnf,rnfidealup(rnf,pr)); ep=(GEN)famo[2]; fac=(GEN)famo[1]; nfac=lg(ep)-1; k=itos(gmael(fac,1,4)); for (j=1; j<=nfac; j++) { if (!gcmp1((GEN)ep[j])) err(bugparier,"rnfnormgroup"); if (cmpis(gmael(fac,j,4),k)) err(talker,"non Galois extension in rnfnormgroup"); } } col=gmulsg(k,isprincipalrayall(bnr,pr,nf_REGULAR)); p1=cgetg(sizemat+2,t_MAT); for (j=1; j<=sizemat; j++) p1[j]=group[j]; p1[sizemat+1]=(long)col; group=hnf(p1); detgroup=dethnf(group); k=cmpis(detgroup,reldeg); if (k<0) err(talker,"not an Abelian extension in rnfnormgroup"); if (!rnf && !k) { cgiv(detgroup); return gerepileupto(av,group); } } } } if (k>0) err(bugparier,"rnfnormgroup"); cgiv(detgroup); return gerepileupto(av,group);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/275f4667f70a314841e502489753d9e76fa02c47/buch3.c/clean/src/basemath/buch3.c
check_pointers(unsigned int ptrs, matcomp *init[])
check_pointers(gp_pointer ptrs[], unsigned int ind)
check_pointers(unsigned int ptrs, matcomp *init[]){ unsigned int i; for (i=0; ptrs; i++,ptrs>>=1) if (ptrs & 1) { matcomp *c = init[i]; GEN *pt = c->ptcell, x = gclone(*pt); if (c->parent == NULL) { if (isclone(c->extra)) killbloc((GEN)c->extra); *pt = x; } else (void)change_compo(c, x); free((void*)c); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d6bc6f7c8515f98a50f281cca0bb8c335aed5b17/anal.c/clean/src/language/anal.c
for (i=0; ptrs; i++,ptrs>>=1) if (ptrs & 1) { matcomp *c = init[i]; GEN *pt = c->ptcell, x = gclone(*pt); if (c->parent == NULL) { if (isclone(c->extra)) killbloc((GEN)c->extra); *pt = x; } else (void)change_compo(c, x); free((void*)c); }
for (i=0; i<ind; i++) { gp_pointer *g = &(ptrs[i]); if (g->ep) changevalue(g->ep, g->x); else (void)change_compo(&(g->c), g->x); }
check_pointers(unsigned int ptrs, matcomp *init[]){ unsigned int i; for (i=0; ptrs; i++,ptrs>>=1) if (ptrs & 1) { matcomp *c = init[i]; GEN *pt = c->ptcell, x = gclone(*pt); if (c->parent == NULL) { if (isclone(c->extra)) killbloc((GEN)c->extra); *pt = x; } else (void)change_compo(c, x); free((void*)c); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d6bc6f7c8515f98a50f281cca0bb8c335aed5b17/anal.c/clean/src/language/anal.c
stackzone *zone;
nfsuppl(GEN nf, GEN x, long n, GEN prhall){ long k, s, t, N, lx=lg(x); gpmem_t av=avma, av2; GEN y,p1,p2,p,unmodp,zeromodp,unnf,zeronf,prh; stackzone *zone; k=lx-1; if (k>n) err(suppler2); if (k && lg(x[1])!=n+1) err(talker,"incorrect dimension in nfsupl"); N=degpol(nf[1]); prh=(GEN)prhall[1]; p=gcoeff(prh,1,1); zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1); unmodp=gmodulsg(1,p); zeromodp=gmodulsg(0,p); unnf=gscalcol_proto(unmodp,zeromodp,N); zeronf=gscalcol_proto(zeromodp,zeromodp,N); y = idmat_intern(n,unnf,zeronf); switch_stack(zone,0); av2=avma; for (s=1; s<=k; s++) { p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++; avma=av2; if (t>n) err(suppler2); p2=(GEN)y[s]; y[s]=x[s]; if (s!=t) y[t]=(long)p2; } avma=av; y=gcopy(y); free(zone); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base4.c/buggy/src/basemath/base4.c
zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1);
nfsuppl(GEN nf, GEN x, long n, GEN prhall){ long k, s, t, N, lx=lg(x); gpmem_t av=avma, av2; GEN y,p1,p2,p,unmodp,zeromodp,unnf,zeronf,prh; stackzone *zone; k=lx-1; if (k>n) err(suppler2); if (k && lg(x[1])!=n+1) err(talker,"incorrect dimension in nfsupl"); N=degpol(nf[1]); prh=(GEN)prhall[1]; p=gcoeff(prh,1,1); zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1); unmodp=gmodulsg(1,p); zeromodp=gmodulsg(0,p); unnf=gscalcol_proto(unmodp,zeromodp,N); zeronf=gscalcol_proto(zeromodp,zeromodp,N); y = idmat_intern(n,unnf,zeronf); switch_stack(zone,0); av2=avma; for (s=1; s<=k; s++) { p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++; avma=av2; if (t>n) err(suppler2); p2=(GEN)y[s]; y[s]=x[s]; if (s!=t) y[t]=(long)p2; } avma=av; y=gcopy(y); free(zone); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base4.c/buggy/src/basemath/base4.c
switch_stack(zone,0); av2=avma;
av2=avma;
nfsuppl(GEN nf, GEN x, long n, GEN prhall){ long k, s, t, N, lx=lg(x); gpmem_t av=avma, av2; GEN y,p1,p2,p,unmodp,zeromodp,unnf,zeronf,prh; stackzone *zone; k=lx-1; if (k>n) err(suppler2); if (k && lg(x[1])!=n+1) err(talker,"incorrect dimension in nfsupl"); N=degpol(nf[1]); prh=(GEN)prhall[1]; p=gcoeff(prh,1,1); zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1); unmodp=gmodulsg(1,p); zeromodp=gmodulsg(0,p); unnf=gscalcol_proto(unmodp,zeromodp,N); zeronf=gscalcol_proto(zeromodp,zeromodp,N); y = idmat_intern(n,unnf,zeronf); switch_stack(zone,0); av2=avma; for (s=1; s<=k; s++) { p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++; avma=av2; if (t>n) err(suppler2); p2=(GEN)y[s]; y[s]=x[s]; if (s!=t) y[t]=(long)p2; } avma=av; y=gcopy(y); free(zone); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base4.c/buggy/src/basemath/base4.c
p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++;
p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++;
nfsuppl(GEN nf, GEN x, long n, GEN prhall){ long k, s, t, N, lx=lg(x); gpmem_t av=avma, av2; GEN y,p1,p2,p,unmodp,zeromodp,unnf,zeronf,prh; stackzone *zone; k=lx-1; if (k>n) err(suppler2); if (k && lg(x[1])!=n+1) err(talker,"incorrect dimension in nfsupl"); N=degpol(nf[1]); prh=(GEN)prhall[1]; p=gcoeff(prh,1,1); zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1); unmodp=gmodulsg(1,p); zeromodp=gmodulsg(0,p); unnf=gscalcol_proto(unmodp,zeromodp,N); zeronf=gscalcol_proto(zeromodp,zeromodp,N); y = idmat_intern(n,unnf,zeronf); switch_stack(zone,0); av2=avma; for (s=1; s<=k; s++) { p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++; avma=av2; if (t>n) err(suppler2); p2=(GEN)y[s]; y[s]=x[s]; if (s!=t) y[t]=(long)p2; } avma=av; y=gcopy(y); free(zone); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base4.c/buggy/src/basemath/base4.c
avma=av; y=gcopy(y); free(zone); return y;
return gerepilecopy(av, lift_intern(y));
nfsuppl(GEN nf, GEN x, long n, GEN prhall){ long k, s, t, N, lx=lg(x); gpmem_t av=avma, av2; GEN y,p1,p2,p,unmodp,zeromodp,unnf,zeronf,prh; stackzone *zone; k=lx-1; if (k>n) err(suppler2); if (k && lg(x[1])!=n+1) err(talker,"incorrect dimension in nfsupl"); N=degpol(nf[1]); prh=(GEN)prhall[1]; p=gcoeff(prh,1,1); zone = switch_stack(NULL, 2*(3 + 2*lg(p) + N+1) + (n+3)*(n+1)); switch_stack(zone,1); unmodp=gmodulsg(1,p); zeromodp=gmodulsg(0,p); unnf=gscalcol_proto(unmodp,zeromodp,N); zeronf=gscalcol_proto(zeromodp,zeromodp,N); y = idmat_intern(n,unnf,zeronf); switch_stack(zone,0); av2=avma; for (s=1; s<=k; s++) { p1=nfsolvemodpr(nf,y,(GEN)x[s],prhall); t=s; while (t<=n && gcmp0((GEN)p1[t])) t++; avma=av2; if (t>n) err(suppler2); p2=(GEN)y[s]; y[s]=x[s]; if (s!=t) y[t]=(long)p2; } avma=av; y=gcopy(y); free(zone); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/eba2fe5ccc5aa3212798bdc178680c89662e2f98/base4.c/buggy/src/basemath/base4.c
p1[3]=(long)rnf; return gerepileupto(av, gcopy(p1));
p1[3]=(long)rnf; return gerepilecopy(av, p1);
makebasis(GEN nf,GEN pol){ GEN elts,ids,polabs,plg,B,bs,p1,p2,a,den,vbs,vbspro,vpro,rnf; long av=avma,n,N,m,i,j, v = varn(pol); p1 = rnfequation2(nf,pol); polabs= (GEN)p1[1]; plg = (GEN)p1[2]; a = (GEN)p1[3]; rnf = cgetg(12,t_VEC); for (i=2;i<=9;i++) rnf[i]=zero; rnf[1] =(long)pol; rnf[10]=(long)nf; p2=cgetg(4,t_VEC); rnf[11]=(long)p2; p2[1]=p2[2]=zero; p2[3]=(long)a; if (signe(a)) pol = gsubst(pol,v,gsub(polx[v], gmul(a,gmodulcp(polx[varn(nf[1])],(GEN)nf[1])))); p1=rnfpseudobasis(nf,pol); elts= (GEN)p1[1]; ids = (GEN)p1[2]; if (DEBUGLEVEL>1) { fprintferr("relative basis computed\n"); flusherr(); } N=degpol(pol); n=degpol((GEN)nf[1]); m=n*N; den = denom(content(lift(plg))); vbs = cgetg(n+1,t_VEC); vbs[1] = un; vbs[2] = (long)plg; vbspro = gmul(den,plg); for(i=3;i<=n;i++) vbs[i] = ldiv(gmul((GEN)vbs[i-1],vbspro),den); bs = gmul(vbs, vecpol_to_mat((GEN)nf[7],n)); vpro=cgetg(N+1,t_VEC); for (i=1;i<=N;i++) { p1=cgetg(3,t_POLMOD); p1[1]=(long)polabs; p1[2]=lpuigs(polx[v],i-1); vpro[i]=(long)p1; } vpro=gmul(vpro,elts); B = cgetg(m+1, t_MAT); for(i=1;i<=N;i++) for(j=1;j<=n;j++) { p1 = gmul(bs, element_mul(nf,(GEN)vpro[i],gmael(ids,i,j))); B[(i-1)*n+j] = (long)pol_to_vec(lift_intern(p1), m); } p1 = denom(B); B = gmul(B,p1); B = hnfmodid(B, p1); B = gdiv(B,p1); p1=cgetg(4,t_VEC); p1[1]=(long)polabs; p1[2]=(long)B; p1[3]=(long)rnf; return gerepileupto(av, gcopy(p1));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base2.c/clean/src/basemath/base2.c
if (ln == 2) return sqrti_spec_2(n, r); if (ln == 1) return sqrti_spec_1(n, r);
if (ln == 2) return sqrtispec2_sh(n, r); if (ln == 1) return sqrtispec1(n, r);
sqrtremi(GEN N, GEN *r){ pari_sp av; GEN S, R, n = N+2; long k, l2, ln = lgefint(N) - 2; int sh; if (ln <= 2) { if (ln == 2) return sqrti_spec_2(n, r); if (ln == 1) return sqrti_spec_1(n, r); *r = gzero; return gzero; } av = avma; sh = bfffo(n[0]) >> 1; l2 = (ln + 1) >> 1; if (sh > 1 || (ln & 1)) { /* normalize n, so that n[0] >= 2^BIL / 4 */ GEN s0, t = new_chunk(ln + 1); t[ln] = 0; if (sh) { shift_left(t, n, 0,ln-1, 0, (sh << 1)); } else xmpn_copy(t, n, ln); S = sqrti_spec(t, l2, &R); /* t normalized, 2 * l2 words */ /* Rescale back: * 2^(2k) n = S^2 + R, k = sh + (ln & 1)*BIL/2 * so 2^(2k) n = (S - s0)^2 + (2*S*s0 - s0^2 + R), s0 = S mod 2^k. */ k = sh + (ln & 1) * (BITS_IN_LONG/2); s0 = resmod2n(S, k); R = addii(shifti(R,-1), mulii(s0, S)); R = shifti(R, 1 - (k<<1)); S = shifti(S, -k); } else S = sqrti_spec(n, l2, &R); if (!r) { avma = (pari_sp)S; return gerepileuptoint(av, S); } gerepileall(av, 2, &S, &R); *r = R; return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/bb644736021b50546346a114cbaa5c805227bc3f/mp.c/buggy/src/kernel/none/mp.c
S = sqrti_spec(t, l2, &R); /* t normalized, 2 * l2 words */
S = sqrtispec(t, l2, &R); /* t normalized, 2 * l2 words */
sqrtremi(GEN N, GEN *r){ pari_sp av; GEN S, R, n = N+2; long k, l2, ln = lgefint(N) - 2; int sh; if (ln <= 2) { if (ln == 2) return sqrti_spec_2(n, r); if (ln == 1) return sqrti_spec_1(n, r); *r = gzero; return gzero; } av = avma; sh = bfffo(n[0]) >> 1; l2 = (ln + 1) >> 1; if (sh > 1 || (ln & 1)) { /* normalize n, so that n[0] >= 2^BIL / 4 */ GEN s0, t = new_chunk(ln + 1); t[ln] = 0; if (sh) { shift_left(t, n, 0,ln-1, 0, (sh << 1)); } else xmpn_copy(t, n, ln); S = sqrti_spec(t, l2, &R); /* t normalized, 2 * l2 words */ /* Rescale back: * 2^(2k) n = S^2 + R, k = sh + (ln & 1)*BIL/2 * so 2^(2k) n = (S - s0)^2 + (2*S*s0 - s0^2 + R), s0 = S mod 2^k. */ k = sh + (ln & 1) * (BITS_IN_LONG/2); s0 = resmod2n(S, k); R = addii(shifti(R,-1), mulii(s0, S)); R = shifti(R, 1 - (k<<1)); S = shifti(S, -k); } else S = sqrti_spec(n, l2, &R); if (!r) { avma = (pari_sp)S; return gerepileuptoint(av, S); } gerepileall(av, 2, &S, &R); *r = R; return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/bb644736021b50546346a114cbaa5c805227bc3f/mp.c/buggy/src/kernel/none/mp.c
S = sqrti_spec(n, l2, &R);
S = sqrtispec(n, l2, &R);
sqrtremi(GEN N, GEN *r){ pari_sp av; GEN S, R, n = N+2; long k, l2, ln = lgefint(N) - 2; int sh; if (ln <= 2) { if (ln == 2) return sqrti_spec_2(n, r); if (ln == 1) return sqrti_spec_1(n, r); *r = gzero; return gzero; } av = avma; sh = bfffo(n[0]) >> 1; l2 = (ln + 1) >> 1; if (sh > 1 || (ln & 1)) { /* normalize n, so that n[0] >= 2^BIL / 4 */ GEN s0, t = new_chunk(ln + 1); t[ln] = 0; if (sh) { shift_left(t, n, 0,ln-1, 0, (sh << 1)); } else xmpn_copy(t, n, ln); S = sqrti_spec(t, l2, &R); /* t normalized, 2 * l2 words */ /* Rescale back: * 2^(2k) n = S^2 + R, k = sh + (ln & 1)*BIL/2 * so 2^(2k) n = (S - s0)^2 + (2*S*s0 - s0^2 + R), s0 = S mod 2^k. */ k = sh + (ln & 1) * (BITS_IN_LONG/2); s0 = resmod2n(S, k); R = addii(shifti(R,-1), mulii(s0, S)); R = shifti(R, 1 - (k<<1)); S = shifti(S, -k); } else S = sqrti_spec(n, l2, &R); if (!r) { avma = (pari_sp)S; return gerepileuptoint(av, S); } gerepileall(av, 2, &S, &R); *r = R; return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/bb644736021b50546346a114cbaa5c805227bc3f/mp.c/buggy/src/kernel/none/mp.c
sqrtu2(GEN a)
sqrtu2(ulong *a)
sqrtu2(GEN a){ double beta = sqrt((double)(ulong)a[0]); return (ulong)(beta * (1UL << BITS_IN_HALFULONG));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/dae47a1f7d6a2266233d6d7c62243c2ac55ce87e/mp.c/clean/src/kernel/none/mp.c
double beta = sqrt((double)(ulong)a[0]);
double beta = sqrt((double)a[0]);
sqrtu2(GEN a){ double beta = sqrt((double)(ulong)a[0]); return (ulong)(beta * (1UL << BITS_IN_HALFULONG));}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/dae47a1f7d6a2266233d6d7c62243c2ac55ce87e/mp.c/clean/src/kernel/none/mp.c
int hi = p_sqrtu2(n[0], n[1], &s, &r);
int hi = p_sqrtu2((ulong*)n, &s, &r);
sqrtispec2(GEN n, GEN *pr){ ulong s, r; int hi = p_sqrtu2(n[0], n[1], &s, &r); GEN S = utoi(s); *pr = hi? cat1u(r): utoi(r); return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/clean/src/kernel/none/mp.c
ulong r, s, u0 = (ulong)n[0], u1 = (ulong)n[1];
ulong *U, r, s, u0 = (ulong)n[0], u1 = (ulong)n[1];
sqrtispec2_sh(GEN n, GEN *pr){ GEN S; ulong r, s, u0 = (ulong)n[0], u1 = (ulong)n[1]; int hi, sh = bfffo(u0) & ~1UL; if (sh) { u0 = (u0 << sh) | (u1 >> (BITS_IN_LONG-sh)); u1 <<= sh; } hi = p_sqrtu2(u0, u1, &s, &r); /* s^2 + R = u0|u1. Rescale back: * 2^(2k) n = S^2 + R * so 2^(2k) n = (S - s0)^2 + (2*S*s0 - s0^2 + R), s0 = S mod 2^k. */ if (sh) { int k = sh >> 1; ulong s0 = s & ((1<<k) - 1); LOCAL_HIREMAINDER; LOCAL_OVERFLOW; r = addll(r, mulll(s, (s0<<1))); if (overflow) hiremainder++; hiremainder += hi; /* + 0 or 1 */ s >>= k; r = (r>>sh) | (hiremainder << (BITS_IN_LONG-sh)); hi = (hiremainder & (1<<sh)); } S = utoi(s); if (pr) *pr = hi? cat1u(r): utoi(r); return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/clean/src/kernel/none/mp.c
hi = p_sqrtu2(u0, u1, &s, &r);
U[0] = u0; U[1] = u1; hi = p_sqrtu2(U, &s, &r);
sqrtispec2_sh(GEN n, GEN *pr){ GEN S; ulong r, s, u0 = (ulong)n[0], u1 = (ulong)n[1]; int hi, sh = bfffo(u0) & ~1UL; if (sh) { u0 = (u0 << sh) | (u1 >> (BITS_IN_LONG-sh)); u1 <<= sh; } hi = p_sqrtu2(u0, u1, &s, &r); /* s^2 + R = u0|u1. Rescale back: * 2^(2k) n = S^2 + R * so 2^(2k) n = (S - s0)^2 + (2*S*s0 - s0^2 + R), s0 = S mod 2^k. */ if (sh) { int k = sh >> 1; ulong s0 = s & ((1<<k) - 1); LOCAL_HIREMAINDER; LOCAL_OVERFLOW; r = addll(r, mulll(s, (s0<<1))); if (overflow) hiremainder++; hiremainder += hi; /* + 0 or 1 */ s >>= k; r = (r>>sh) | (hiremainder << (BITS_IN_LONG-sh)); hi = (hiremainder & (1<<sh)); } S = utoi(s); if (pr) *pr = hi? cat1u(r): utoi(r); return S;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/clean/src/kernel/none/mp.c
idealsqrtn(GEN nf, GEN x, GEN gn)
idealsqrtn(GEN nf, GEN x, GEN gn, int strict)
idealsqrtn(GEN nf, GEN x, GEN gn){ long i, l, n = itos(gn); GEN fa, q, Ex, Pr; fa = idealfactor(nf, x); Pr = (GEN)fa[1]; l = lg(Pr); Ex = (GEN)fa[2]; q = NULL; for (i=1; i<l; i++) { long ex = itos((GEN)Ex[i]); GEN e = stoi(ex / n); if (ex % n) err(talker,"not an n-th power in idealsqrtn"); if (q) q = idealmulpowprime(nf, q, (GEN)Pr[i], e); else q = idealpow(nf, (GEN)Pr[i], e); } return q? q: gun;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c
if (ex % n) err(talker,"not an n-th power in idealsqrtn");
if (strict && ex % n) err(talker,"not an n-th power in idealsqrtn");
idealsqrtn(GEN nf, GEN x, GEN gn){ long i, l, n = itos(gn); GEN fa, q, Ex, Pr; fa = idealfactor(nf, x); Pr = (GEN)fa[1]; l = lg(Pr); Ex = (GEN)fa[2]; q = NULL; for (i=1; i<l; i++) { long ex = itos((GEN)Ex[i]); GEN e = stoi(ex / n); if (ex % n) err(talker,"not an n-th power in idealsqrtn"); if (q) q = idealmulpowprime(nf, q, (GEN)Pr[i], e); else q = idealpow(nf, (GEN)Pr[i], e); } return q? q: gun;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c
z = gmael(L,1,1); /* either a bid or [bid,U] */
z = gel(L,1); if (typ(z) != t_VEC) err(typeer, "ideallistarch"); z = gel(z,1); /* either a bid or [bid,U] */
ideallistarch(GEN bnf, GEN L, GEN arch){ pari_sp av; long i, j, l = lg(L), lz; GEN v, z, V; ideal_data ID; GEN (*join_z)(ideal_data*, GEN) = &join_arch; if (typ(L) != t_VEC) err(typeer, "ideallistarch"); if (l == 1) return cgetg(1,t_VEC); z = gmael(L,1,1); /* either a bid or [bid,U] */ if (lg(z) == 3) { /* the latter: do units */ if (typ(z) != t_VEC) err(typeer,"ideallistarch"); join_z = &join_archunit; ID.sgnU = zsignunits(bnf, NULL, 1); } ID.nf = checknf(bnf); arch = arch_to_perm(arch); av = avma; V = cgetg(l, t_VEC); for (i = 1; i < l; i++) { z = gel(L,i); lz = lg(z); gel(V,i) = v = cgetg(lz,t_VEC); for (j=1; j<lz; j++) gel(v,j) = join_z(&ID, gel(z,j)); } return gerepilecopy(av,V);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/cce7d33d7e8a5639b6ac6b03de02d005b1ce3fdc/base3.c/buggy/src/basemath/base3.c
&rtems_filesystem_null_handlers, /* for linearfiles */
int miniIMFS_initialize( rtems_filesystem_mount_table_entry_t *temp_mt_entry){ IMFS_initialize_support( temp_mt_entry, &miniIMFS_ops, &rtems_filesystem_null_handlers, /* for memfiles */ &rtems_filesystem_null_handlers /* for directories */ ); return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/0ef748fb45137bac811ded19dfad2034f924505a/miniimfs_init.c/buggy/cpukit/libfs/src/imfs/miniimfs_init.c
the_thread ? *the_thread->Object.name :
the_thread ? *(unsigned32 *)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; 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; printf( "0x%08x 0x%08x 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, the_thread ? *the_thread->Object.name : rtems_build_name('I', 'N', 'T', 'R'), (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/check.c/clean/c/src/libmisc/stackchk/check.c
static apr_status_t ssl_init_context( serf_ssl_context_t *ssl_ctx, serf_bucket_alloc_t *allocator)
static serf_ssl_context_t *ssl_init_context()
static apr_status_t ssl_init_context( serf_ssl_context_t *ssl_ctx, serf_bucket_alloc_t *allocator){ /* XXX Only do this ONCE! */ SSL_library_init(); OpenSSL_add_ssl_algorithms(); SSL_load_error_strings(); ERR_load_crypto_strings(); /* This is wrong-ish. */ ssl_ctx->ctx = SSL_CTX_new(SSLv23_client_method()); SSL_CTX_set_options(ssl_ctx->ctx, SSL_OP_ALL); ssl_ctx->ssl = SSL_new(ssl_ctx->ctx); ssl_ctx->bio = BIO_new(&bio_bucket_method); ssl_ctx->bio->ptr = ssl_ctx; SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio); SSL_set_connect_state(ssl_ctx->ssl); ssl_ctx->source = serf_bucket_aggregate_create(allocator); ssl_ctx->sink = serf_bucket_aggregate_create(allocator); return APR_SUCCESS;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/7e991ed74df081a3cb5225578c7cbaa29fe05efa/ssl_buckets.c/buggy/buckets/ssl_buckets.c
ssl_ctx->source = serf_bucket_aggregate_create(allocator); ssl_ctx->sink = serf_bucket_aggregate_create(allocator);
ssl_ctx->source = serf_bucket_aggregate_create(ssl_ctx->allocator); ssl_ctx->sink = serf_bucket_aggregate_create(ssl_ctx->allocator);
static apr_status_t ssl_init_context( serf_ssl_context_t *ssl_ctx, serf_bucket_alloc_t *allocator){ /* XXX Only do this ONCE! */ SSL_library_init(); OpenSSL_add_ssl_algorithms(); SSL_load_error_strings(); ERR_load_crypto_strings(); /* This is wrong-ish. */ ssl_ctx->ctx = SSL_CTX_new(SSLv23_client_method()); SSL_CTX_set_options(ssl_ctx->ctx, SSL_OP_ALL); ssl_ctx->ssl = SSL_new(ssl_ctx->ctx); ssl_ctx->bio = BIO_new(&bio_bucket_method); ssl_ctx->bio->ptr = ssl_ctx; SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio); SSL_set_connect_state(ssl_ctx->ssl); ssl_ctx->source = serf_bucket_aggregate_create(allocator); ssl_ctx->sink = serf_bucket_aggregate_create(allocator); return APR_SUCCESS;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/7e991ed74df081a3cb5225578c7cbaa29fe05efa/ssl_buckets.c/buggy/buckets/ssl_buckets.c
return APR_SUCCESS;
ssl_ctx->source_status = APR_SUCCESS; ssl_ctx->sink_status = APR_SUCCESS; return ssl_ctx;
static apr_status_t ssl_init_context( serf_ssl_context_t *ssl_ctx, serf_bucket_alloc_t *allocator){ /* XXX Only do this ONCE! */ SSL_library_init(); OpenSSL_add_ssl_algorithms(); SSL_load_error_strings(); ERR_load_crypto_strings(); /* This is wrong-ish. */ ssl_ctx->ctx = SSL_CTX_new(SSLv23_client_method()); SSL_CTX_set_options(ssl_ctx->ctx, SSL_OP_ALL); ssl_ctx->ssl = SSL_new(ssl_ctx->ctx); ssl_ctx->bio = BIO_new(&bio_bucket_method); ssl_ctx->bio->ptr = ssl_ctx; SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio); SSL_set_connect_state(ssl_ctx->ssl); ssl_ctx->source = serf_bucket_aggregate_create(allocator); ssl_ctx->sink = serf_bucket_aggregate_create(allocator); return APR_SUCCESS;}
1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/7e991ed74df081a3cb5225578c7cbaa29fe05efa/ssl_buckets.c/buggy/buckets/ssl_buckets.c
if (DEBUGLEVEL>5) { fprintferr("(u,v) = (%Z, %Z); ",u,v); flusherr(); }
ZV_elem(GEN aj, GEN ak, GEN A, GEN U, long j, long k){ GEN p1,u,v,d; if (!signe(ak)) { swap(A[j],A[k]); if (U) swap(U[j],U[k]); return; } d = bezout(aj,ak,&u,&v); /* frequent special case (u,v) = (1,0) or (0,1) */ if (!signe(u)) { /* ak | aj */ p1 = negi(divii(aj,ak)); A[j] = (long)ZV_lincomb(gun, p1, (GEN)A[j], (GEN)A[k]); if (U) U[j] = (long)ZV_lincomb(gun, p1, (GEN)U[j], (GEN)U[k]); return; } if (!signe(v)) { /* aj | ak */ p1 = negi(divii(ak,aj)); A[k] = (long)ZV_lincomb(gun, p1, (GEN)A[k], (GEN)A[j]); swap(A[j], A[k]); if (U) { U[k] = (long)ZV_lincomb(gun, p1, (GEN)U[k], (GEN)U[j]); swap(U[j], U[k]); } return; } if (!is_pm1(d)) { aj = divii(aj,d); ak = divii(ak,d); } if (DEBUGLEVEL>5) { fprintferr("(u,v) = (%Z, %Z); ",u,v); flusherr(); } p1 = (GEN)A[k]; aj = negi(aj); A[k] = (long)ZV_lincomb(u,v, (GEN)A[j],p1); A[j] = (long)ZV_lincomb(aj,ak, p1,(GEN)A[j]); if (U) { p1 = (GEN)U[k]; U[k] = (long)ZV_lincomb(u,v, (GEN)U[j],p1); U[j] = (long)ZV_lincomb(aj,ak, p1,(GEN)U[j]); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/f33a4506872d16621b8b9cd001e28d60e1b387d3/alglin2.c/clean/src/basemath/alglin2.c
long i,j,k, l = lg(r)-1; GEN allr, ro1 = (h==1)? NULL: initRUgen(h, bitprec);
long i, j, k, l, prec; GEN allr, ro1; if (h == 1) return fix_roots1(r, m, bitprec); ro1 = initRUgen(h, bitprec); prec = precision((GEN)r[1]); l = lg(r)-1;
fix_roots(GEN r, GEN *m, long h, long bitprec){ long i,j,k, l = lg(r)-1; GEN allr, ro1 = (h==1)? NULL: initRUgen(h, bitprec); allr = cgetg(h*l+1, t_VEC); for (k=1,i=1; i<=l; i++) { GEN p2, p1 = (GEN)r[i]; if (!ro1) allr[k++] = lcopy(p1); else { p2 = (h == 2)? gsqrt(p1,0): gpow(p1, ginv(stoi(h)), 0); for (j=0; j<h; j++) allr[k++] = lmul(p2, (GEN)ro1[j]); } gunclone(p1); } if (ro1) *m = roots_to_pol(allr, varn(*m)); return allr;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a392c9001d525a4db3a94cdec84436ff6299813f/rootpol.c/buggy/src/basemath/rootpol.c
if (!ro1) allr[k++] = lcopy(p1); else { p2 = (h == 2)? gsqrt(p1,0): gpow(p1, ginv(stoi(h)), 0); for (j=0; j<h; j++) allr[k++] = lmul(p2, (GEN)ro1[j]); }
p2 = (h == 2)? gsqrt(p1, prec): gsqrtn(p1, stoi(h), NULL, prec); for (j=0; j<h; j++) allr[k++] = lmul(p2, (GEN)ro1[j]);
fix_roots(GEN r, GEN *m, long h, long bitprec){ long i,j,k, l = lg(r)-1; GEN allr, ro1 = (h==1)? NULL: initRUgen(h, bitprec); allr = cgetg(h*l+1, t_VEC); for (k=1,i=1; i<=l; i++) { GEN p2, p1 = (GEN)r[i]; if (!ro1) allr[k++] = lcopy(p1); else { p2 = (h == 2)? gsqrt(p1,0): gpow(p1, ginv(stoi(h)), 0); for (j=0; j<h; j++) allr[k++] = lmul(p2, (GEN)ro1[j]); } gunclone(p1); } if (ro1) *m = roots_to_pol(allr, varn(*m)); return allr;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a392c9001d525a4db3a94cdec84436ff6299813f/rootpol.c/buggy/src/basemath/rootpol.c
if (ro1) *m = roots_to_pol(allr, varn(*m));
*m = roots_to_pol(allr, varn(*m));
fix_roots(GEN r, GEN *m, long h, long bitprec){ long i,j,k, l = lg(r)-1; GEN allr, ro1 = (h==1)? NULL: initRUgen(h, bitprec); allr = cgetg(h*l+1, t_VEC); for (k=1,i=1; i<=l; i++) { GEN p2, p1 = (GEN)r[i]; if (!ro1) allr[k++] = lcopy(p1); else { p2 = (h == 2)? gsqrt(p1,0): gpow(p1, ginv(stoi(h)), 0); for (j=0; j<h; j++) allr[k++] = lmul(p2, (GEN)ro1[j]); } gunclone(p1); } if (ro1) *m = roots_to_pol(allr, varn(*m)); return allr;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a392c9001d525a4db3a94cdec84436ff6299813f/rootpol.c/buggy/src/basemath/rootpol.c
GEN p1 = chinese(mkintmodu(A,B), mkintmodu(0,h));
GEN p1 = chinese(mkintmodu(smodss(A,B),B), mkintmodu(0,h));
apell0(GEN e, ulong p){ sellpt f, fh, fg, ftest, F; ulong x, u, c4, c6, cp4, p1p, p2p, h; long pordmin,A,B; long i, s, KRO, KROold, l, r, m; pari_sp av; multiple *table; if (p < 99) return apell2_intern(e,(ulong)p); table = NULL; av = avma; c4 = itou( lift_intern( gmodgs(gdivgs((GEN)e[10], -48), (long)p) ) ); c6 = itou( lift_intern( gmodgs(gdivgs((GEN)e[11], -864), (long)p) ) ); pordmin = (long)(1 + 4*sqrt((float)p)); p1p = p+1; p2p = p1p << 1; x = 0; u = c6; KRO = kross(u, p); KROold = -KRO; A = 0; B = 1; h = p1p; for(;;) { while (!KRO || KRO == KROold) { ulong t; if (++x >= p) err(talker, "%lu is not prime, use ellak", p); t = Fl_add(c4, Fl_mul(x,x,p), p); u = Fl_add(c6, Fl_mul(x, t, p), p); KRO = kross(u,p); } KROold = KRO; f.isnull = 0; f.x = Fl_mul(x, u, p); f.y = Fl_mul(u, u, p); cp4 = Fl_mul(c4, f.y, p); s_powell(&fh, &f, h, cp4, p); s = (long) (sqrt(((float)pordmin)/B) / 2); if (!s) s = 1; if (!table) { table = (multiple *) gpmalloc((s+1) * sizeof(multiple)); F = f; } else s_powell(&F, &f, B, cp4, p); for (i=0; i < s; i++) { if (fh.isnull) { h += B*i; goto FOUND; } table[i].x = fh.x; table[i].y = fh.y; table[i].i = i; s_addell(&fh, &F, cp4, p); } qsort(table,s,sizeof(multiple),(QSCOMP)compare_multiples); s_powell(&fg, &F, s, cp4, p); ftest = fg; for (i=1; ; i++) { if (ftest.isnull) { if (!isprime(utoi(p))) err(talker,"%lu is not prime, use ellak", p); err(bugparier,"apell (f^(i*s) = 1)"); } l=0; r=s; while (l<r) { m = (l+r) >> 1; if (table[m].x < ftest.x) l=m+1; else r=m; } if (r < s && table[r].x == ftest.x) break; s_addell(&ftest, &fg, cp4, p); } h += table[r].i * B; if (table[r].y == ftest.y) i = -i; h += s * i * B;FOUND: h = sexact_order(h, &f, cp4, p); if (B == 1) B = h; else { GEN p1 = chinese(mkintmodu(A,B), mkintmodu(0,h)); A = itos((GEN)p1[2]); if (is_bigint(p1[1])) { h = A; break; } B = itos((GEN)p1[1]); } i = (B < pordmin); if (i) { A = (p2p - A) % B; if ((A << 1) > B) A -= B; } /* h = A mod B, closest lift to p+1 */ h = A + B * (((ulong)(p2p + B - (A << 1))) / (B << 1)); avma = av; if (!i) break; } if (table) free(table); return stoi(KRO==1? p1p-h: h-p1p);}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/97a7b05e0afe80ff19e7ba8765b9a29a4cc4a2f4/elliptic.c/buggy/src/modules/elliptic.c
ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1;
long theroot, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64;
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0);
c += ((a21 + a42 + a63) & 1); else { if (((1 + a21 + a42 + a63) % 3) == 0) c++; if (((1 - a21 + a42 - a63) % 3) == 0) c++; }
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
/* I0* */ case 2: /* compute nu */
case 2: /* I0* */ { /* compute nu */ GEN pk, pk1, p2k; long al, be, ga;
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++;
pk = mului(p, pk); p2k = mului(p, p2k); nu++;
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
/* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0);
} case 1: /* Inu* */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot*p), gen_0, gen_0);
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p));
if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p2));
localred_23(GEN e, long p){ long c, nu, nuD, r, s, t; ulong theroot, al, be, ga, p2, p3, p4, p5, p6, a21, a42, a63, a32, a64; GEN pk, p2k, pk1; GEN v; nuD = Z_lval(gel(e,12), (ulong)p); v = init_ch(); if (p == 2) { p2 = 4; p3 = 8; p4 = 16; p5 = 32; p6 = 64;} else { p2 = 9; p3 = 27; p4 = 81; p5 =243; p6 =729; } for (;;) { if (!nuD) return localred_result(0, 1, 1, v); /* I0 */ if (umodiu(gel(e,6), p)) /* p \nmid b2 */ { if (umodiu(negi(gel(e,11)), p == 2 ? 8 : 3) == 1) c = nuD; else c = 2 - (nuD & 1); return localred_result(1, 4 + nuD, c, v); } /* Inu */ if (p == 2) { r = umodiu(gel(e,4), 2); s = umodiu(gel(e,2), 2); t = umodiu(gel(e,5), 2); if (r) { t = (s + t) & 1; s = (s + 1) & 1; } } else /* p == 3 */ { r = - umodiu(gel(e,8), 3); s = umodiu(gel(e,1), 3); t = umodiu(gel(e,3), 3); if (s) { t = (t + r*s) % 3; if (t < 0) t += 3; } } /* p | (a1, a2, a3, a4, a6) */ if (r || s || t) cumule(&v, &e, gen_1, stoi(r), stoi(s), stoi(t)); if (umodiu(gel(e,5), p2)) return localred_result(nuD, 2, 1, v); /* II */ if (umodiu(gel(e,9), p3)) return localred_result(nuD - 1, 3, 2, v); /* III */ if (umodiu(gel(e,8), p3)) { if (umodiu(gel(e,8), (p==2)? 32: 27) == (ulong)p2) c = 3; else c = 1; return localred_result(nuD - 2, 4, c, v); } /* IV */ if (umodiu(gel(e,5), p3)) cumule(&v, &e, gen_1, gen_0, gen_0, p == 2? gen_2: modis(gel(e,3), 9)); /* p | a1, a2; p^2 | a3, a4; p^3 | a6 */ a21 = aux(gel(e,2), p2, p); a42 = aux(gel(e,4), p3, p2); a63 = aux(gel(e,5), p4, p3); switch (numroots3(a21, a42, a63, p, &theroot)) { case 3: if (p == 2) c = 1 + (a63 == 0) + ((a21 + a42 + a63) & 1); else c = 1 + (a63 == 0) + (((1 + a21 + a42 + a63) % 3) == 0) + (((1 - a21 + a42 - a63) % 3) == 0); return localred_result(nuD - 4, -1, c, v); /* I0* */ case 2: /* compute nu */ if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ nu = 1; pk = utoipos(p2); p2k = utoipos(p4); for(;;) { be = aux2(gel(e,3), p, pk); ga = -aux2(gel(e,5), p, p2k); al = 1; if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, mulsi(theroot,pk)); pk1 = pk; pk = mulsi(p, pk); p2k = mulsi(p, p2k); nu++; al = a21; be = aux2(gel(e,4), p, pk); ga = aux2(gel(e,5), p, p2k); if (numroots2(al, be, ga, p, &theroot) == 2) break; if (theroot) cumule(&v, &e, gen_1, mulsi(theroot, pk1), gen_0, gen_0); p2k = mulsi(p, p2k); nu++; } if (p == 2) c = 4 - 2 * (ga & 1); else c = 3 + kross(be * be - al * ga, 3); return localred_result(nuD - 4 - nu, -4 - nu, c, v); /* Inu* */ case 1: if (theroot) cumule(&v, &e, gen_1, stoi(theroot * p), gen_0, gen_0); /* p | a1; p^2 | a2, a3; p^3 | a4; p^4 | a6 */ a32 = aux(gel(e,3), p3, p2); a64 = aux(gel(e,5), p5, p4); if (numroots2(1, a32, -a64, p, &theroot) == 2) { if (p == 2) c = 3 - 2 * a64; else c = 2 + kross(a32 * a32 + a64, 3); return localred_result(nuD - 6, -4, c, v); } /* IV* */ if (theroot) cumule(&v, &e, gen_1, gen_0, gen_0, stoi(theroot*p*p)); /* p | a1; p^2 | a2; p^3 | a3, a4; p^5 | a6 */ if (umodiu(gel(e,4), p4)) return localred_result(nuD - 7, -3, 2, v); /* III* */ if (umodiu(gel(e,5), p6)) return localred_result(nuD - 8, -2, 1, v); /* II* */ cumule(&v, &e, utoipos(p), gen_0, gen_0, gen_0); /* not minimal */ nuD -= 12; } }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e52356c6b3f22b2b543660d24ca70ed54ad1ce48/elliptic.c/clean/src/modules/elliptic.c
case t_INTMOD: case t_PADIC: case t_POLMOD:
case t_INTMOD: case t_PADIC: err(impl, "padic polylogarithm"); case t_POLMOD:
gpolylog(long m, GEN x, long prec){ long i,lx,av=avma,tetpil,v,n; GEN y,p1,p2; if (m<=0) { p1=polx[0]; p2=gsub(gun,p1); for (i=1; i<=(-m); i++) p1=gmul(polx[0],gadd(gmul(p2,derivpol(p1)),gmulsg(i,p1))); p1=gdiv(p1,gpuigs(p2,1-m)); tetpil=avma; return gerepile(av,tetpil,poleval(p1,x)); } switch(typ(x)) { case t_INT: case t_REAL: case t_FRAC: case t_FRACN: case t_COMPLEX: case t_QUAD: return polylog(m,x,prec); case t_INTMOD: case t_PADIC: case t_POLMOD: p1=roots((GEN)x[1],prec); lx=lg(p1); p2=cgetg(lx,t_COL); for (i=1; i<lx; i++) p2[i]=lpoleval((GEN)x[2],(GEN)p1[i]); tetpil=avma; y=cgetg(lx,t_COL); for (i=1; i<lx; i++) y[i]=(long)polylog(m,(GEN)p2[i],prec); return gerepile(av,tetpil,y); case t_POL: case t_RFRAC: case t_RFRACN: p1=tayl(x,gvar(x),precdl); tetpil=avma; return gerepile(av,tetpil,gpolylog(m,p1,prec)); case t_SER: if (!m) return gneg(ghalf); if (m==1) { p1=glog(gsub(gun,x),prec); tetpil=avma; return gerepile(av,tetpil,gneg(p1)); } if (valp(x)<=0) err(impl,"polylog around a!=0"); v=varn(x); n=(lg(x)-2)/valp(x); y=ggrando(polx[v],lg(x)-2); for (i=n; i>=1; i--) { p1=gadd(gpuigs(stoi(i),-m),y); tetpil=avma; y=gmul(x,p1); } return gerepile(av,tetpil,y); case t_VEC: case t_COL: case t_MAT: lx=lg(x); y=cgetg(lx,typ(x)); for (i=1; i<lx; i++) y[i]=(long)gpolylog(m,(GEN)x[i],prec); return y; } err(typeer,"gpolylog"); return NULL; /* not reached */}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/88886e5d9c3a9681343a9c35e7d0ffe1e3588045/trans3.c/buggy/src/basemath/trans3.c
if (typ(nmax)!=t_INT || signe(nmax) < 0) err(talker,"bad number of components in vector");
if (typ(nmax) != t_INT) err(typeer,"vector");
vecteursmall(GEN nmax, entree *ep, char *ch){ GEN y; long i,m; long c[]={evaltyp(t_INT)|_evallg(3), evalsigne(1)|evallgefint(3), 0}; if (typ(nmax)!=t_INT || signe(nmax) < 0) err(talker,"bad number of components in vector"); m = itos(nmax); if (!ep || !ch) return vecsmall_const(m, 0); y = cgetg(m+1,t_VECSMALL); push_val(ep, c); for (i=1; i<=m; i++) { c[2] = i; y[i] = itos(lisseq_nobreak(ch)); } pop_val(ep); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a359ce125544e6952961f755ac643cf90ca1ccb7/sumiter.c/buggy/src/language/sumiter.c
y = cgetg(m+1,t_VECSMALL); push_val(ep, c);
y = cgetg(m+1,t_VECSMALL); push_val(ep, c);
vecteursmall(GEN nmax, entree *ep, char *ch){ GEN y; long i,m; long c[]={evaltyp(t_INT)|_evallg(3), evalsigne(1)|evallgefint(3), 0}; if (typ(nmax)!=t_INT || signe(nmax) < 0) err(talker,"bad number of components in vector"); m = itos(nmax); if (!ep || !ch) return vecsmall_const(m, 0); y = cgetg(m+1,t_VECSMALL); push_val(ep, c); for (i=1; i<=m; i++) { c[2] = i; y[i] = itos(lisseq_nobreak(ch)); } pop_val(ep); return y;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a359ce125544e6952961f755ac643cf90ca1ccb7/sumiter.c/buggy/src/language/sumiter.c
#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support, #else NULL, #endif
_MESSAGE_QUEUE_CORE_MESSAGE_QUEUE_MP_SUPPORT,
rtems_status_code rtems_message_queue_broadcast( Objects_Id id, void *buffer, unsigned32 size, unsigned32 *count){ register Message_queue_Control *the_message_queue; Objects_Locations location; CORE_message_queue_Status core_status; the_message_queue = _Message_queue_Get( id, &location ); switch ( location ) { case OBJECTS_REMOTE:#if defined(RTEMS_MULTIPROCESSING) _Thread_Executing->Wait.return_argument = count; return _Message_queue_MP_Send_request_packet( MESSAGE_QUEUE_MP_BROADCAST_REQUEST, id, buffer, &size, 0, /* option_set not used */ MPCI_DEFAULT_TIMEOUT );#endif case OBJECTS_ERROR: return RTEMS_INVALID_ID; case OBJECTS_LOCAL: core_status = _CORE_message_queue_Broadcast( &the_message_queue->message_queue, buffer, size, id,#if defined(RTEMS_MULTIPROCESSING) _Message_queue_Core_message_queue_mp_support,#else NULL,#endif count ); _Thread_Enable_dispatch(); return _Message_queue_Translate_core_message_queue_return_code( core_status ); } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f4a8ee1c55788aeb053ede7571b07906a9847a45/msg.c/clean/c/src/exec/rtems/src/msg.c
rtems_unsigned16 vec_idx = vector - DMV170_IRQ_FIRST; rtems_unsigned32 index;
uint16_t vec_idx = vector - DMV170_IRQ_FIRST; uint32_t index;
rtems_isr_entry set_EE_vector( rtems_isr_entry handler, /* isr routine */ rtems_vector_number vector /* vector number */){ rtems_unsigned16 vec_idx = vector - DMV170_IRQ_FIRST; rtems_unsigned32 index; /* * Verify that all of the nodes have not been used. */ assert (Nodes_Used < NUM_LIRQ_HANDLERS); /* * If we have already installed this handler for this vector, then * just reset it. */ for ( index=0 ; index <= Nodes_Used ; index++ ) { if ( ISR_Nodes[index].vector == vector && ISR_Nodes[index].handler == handler ) return 0; } /* * Increment the number of nedes used and set the index for the node * array. */ Nodes_Used++; index = Nodes_Used - 1; /* * Write the values of the handler and the vector to this node. */ ISR_Nodes[index].handler = handler; ISR_Nodes[index].vector = vector; /* * Connect this node to the chain at the location of the * vector index. */ Chain_Append( &ISR_Array[vec_idx], &ISR_Nodes[index].Node ); /* * Enable the LIRQ interrupt. */ SCV64_Generate_DUART_Interrupts(); /* * No interrupt service routine was removed so return 0 */ return 0;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ed9e44994265d3dccca845c7aade2f634184c339/genpvec.c/buggy/c/src/lib/libbsp/powerpc/dmv177/startup/genpvec.c
char new_name[ NAME_MAX + 1 ];
char new_name[ IMFS_NAME_MAX + 1 ];
int IMFS_symlink( rtems_filesystem_location_info_t *parent_loc, const char *link_name, const char *node_name){ IMFS_types_union info; IMFS_jnode_t *new_node; char new_name[ NAME_MAX + 1 ]; int i; /* * Remove any separators at the end of the string. */ IMFS_get_token( node_name, new_name, &i ); info.sym_link.name = link_name; /* * Create a new link node. */ new_node = IMFS_create_node( parent_loc, IMFS_SYM_LINK, new_name, ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), &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_symlink.c/clean/c/src/libfs/src/imfs/imfs_symlink.c
/* * check to see if snd wakeup callback was set */ if ( tty->tty_snd.sw_pfn != NULL) { (*tty->tty_snd.sw_pfn)(&tty->termios, tty->tty_snd.sw_arg); }
rtems_termios_refill_transmitter (struct rtems_termios_tty *tty){ unsigned int newTail; int nToSend; rtems_interrupt_level level; int len; /* check for XOF/XON to send */ if ((tty->flow_ctrl & (FL_MDXOF | FL_IREQXOF | FL_ISNTXOF)) == (FL_MDXOF | FL_IREQXOF)) { /* XOFF should be sent now... */ (*tty->device.write)(tty->minor, &(tty->termios.c_cc[VSTOP]), 1); rtems_interrupt_disable(level); tty->t_dqlen--; tty->flow_ctrl |= FL_ISNTXOF; rtems_interrupt_enable(level); nToSend = 1; } else if ((tty->flow_ctrl & (FL_IREQXOF | FL_ISNTXOF)) == FL_ISNTXOF) { /* NOTE: send XON even, if no longer in XON/XOFF mode... */ /* XON should be sent now... */ /* * FIXME: this .write call will generate another * dequeue callback. This will advance the "Tail" in the data * buffer, although the corresponding data is not yet out! * Therefore the dequeue "length" should be reduced by 1 */ (*tty->device.write)(tty->minor, &(tty->termios.c_cc[VSTART]), 1); rtems_interrupt_disable(level); tty->t_dqlen--; tty->flow_ctrl &= ~FL_ISNTXOF; rtems_interrupt_enable(level); nToSend = 1; } else { if ( tty->rawOutBuf.Head == tty->rawOutBuf.Tail ) { /* * buffer was empty */ if (tty->rawOutBufState == rob_wait) { /* * this should never happen... */ rtems_semaphore_release (tty->rawOutBuf.Semaphore); } return 0; } rtems_interrupt_disable(level); len = tty->t_dqlen; tty->t_dqlen = 0; rtems_interrupt_enable(level); newTail = (tty->rawOutBuf.Tail + len) % tty->rawOutBuf.Size; tty->rawOutBuf.Tail = newTail; if (tty->rawOutBufState == rob_wait) { /* * wake up any pending writer task */ rtems_semaphore_release (tty->rawOutBuf.Semaphore); } if (newTail == tty->rawOutBuf.Head) { /* * Buffer has become empty */ tty->rawOutBufState = rob_idle; nToSend = 0; } /* check, whether output should stop due to received XOFF */ else if ((tty->flow_ctrl & (FL_MDXON | FL_ORCVXOF)) == (FL_MDXON | FL_ORCVXOF)) { /* Buffer not empty, but output stops due to XOFF */ /* set flag, that output has been stopped */ rtems_interrupt_disable(level); tty->flow_ctrl |= FL_OSTOP; tty->rawOutBufState = rob_busy; /*apm*/ rtems_interrupt_enable(level); nToSend = 0; } else { /* * Buffer not empty, start tranmitter */ if (newTail > tty->rawOutBuf.Head) nToSend = tty->rawOutBuf.Size - newTail; else nToSend = tty->rawOutBuf.Head - newTail; /* when flow control XON or XOF, don't send blocks of data */ /* to allow fast reaction on incoming flow ctrl and low latency*/ /* for outgoing flow control */ if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) { nToSend = 1; } tty->rawOutBufState = rob_busy; /*apm*/ (*tty->device.write)(tty->minor, (char *)&tty->rawOutBuf.theBuf[newTail], nToSend); } tty->rawOutBuf.Tail = newTail; /*apm*/ } return nToSend;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/c0af4e4799ee02834cc8aaf7f1d81048c1292a45/termios.c/clean/c/src/lib/libc/termios.c
char ch
unsigned char ch
void console_outbyte_polled( int port, char ch){ if ( port == 0 ) { while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 ); ERC32_MEC.UART_Channel_A = (int) ch; return; } while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 ); ERC32_MEC.UART_Channel_B = (int) ch;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/6de4727fd21f29daa8cdccaf031c3d4127abff39/debugputs.c/clean/c/src/lib/libbsp/sparc/erc32/console/debugputs.c
ERC32_MEC.UART_Channel_A = (int) ch;
ERC32_MEC.UART_Channel_A = (unsigned int) ch;
void console_outbyte_polled( int port, char ch){ if ( port == 0 ) { while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 ); ERC32_MEC.UART_Channel_A = (int) ch; return; } while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 ); ERC32_MEC.UART_Channel_B = (int) ch;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/6de4727fd21f29daa8cdccaf031c3d4127abff39/debugputs.c/clean/c/src/lib/libbsp/sparc/erc32/console/debugputs.c
ERC32_MEC.UART_Channel_B = (int) ch;
ERC32_MEC.UART_Channel_B = (unsigned int) ch;
void console_outbyte_polled( int port, char ch){ if ( port == 0 ) { while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 ); ERC32_MEC.UART_Channel_A = (int) ch; return; } while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 ); ERC32_MEC.UART_Channel_B = (int) ch;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/6de4727fd21f29daa8cdccaf031c3d4127abff39/debugputs.c/clean/c/src/lib/libbsp/sparc/erc32/console/debugputs.c
long i, d = lgef(polbase), ct = 3;
long i, d = lgef(polbase), ct = 5;
is_sqf(GEN nf, GEN polbase){ GEN lt, pr, prh, p2, p; long i, d = lgef(polbase), ct = 3; lt = (GEN)leading_term(polbase)[1]; while (ct > 0) { /* small primes tend to divide discriminants more often than large ones so we look at primes >= 101 */ pr = choose_prime(nf,lt,stoi(101),30); if (!pr) break; p=(GEN)pr[1]; prh=prime_to_ideal(nf,pr); p2=gcopy(polbase); lt=mpinvmod(lt,p); for (i=2; i<d; i++) p2[i] = nfreducemodpr_i(gmul(lt,(GEN)p2[i]), prh)[1]; p2 = normalizepol(p2); /* discriminant is non-zero => polynomial is square-free */ if (!gcmp0(p2) && !divise(discsr(p2),p)) { return 1; } ct--; } return 0;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7b661a855d44c832d0c0bd278f0a3a8020f95952/nffactor.c/clean/src/modules/nffactor.c
pr = choose_prime(nf,lt,stoi(101),30);
pr = choose_prime(nf,lt,p,30);
is_sqf(GEN nf, GEN polbase){ GEN lt, pr, prh, p2, p; long i, d = lgef(polbase), ct = 3; lt = (GEN)leading_term(polbase)[1]; while (ct > 0) { /* small primes tend to divide discriminants more often than large ones so we look at primes >= 101 */ pr = choose_prime(nf,lt,stoi(101),30); if (!pr) break; p=(GEN)pr[1]; prh=prime_to_ideal(nf,pr); p2=gcopy(polbase); lt=mpinvmod(lt,p); for (i=2; i<d; i++) p2[i] = nfreducemodpr_i(gmul(lt,(GEN)p2[i]), prh)[1]; p2 = normalizepol(p2); /* discriminant is non-zero => polynomial is square-free */ if (!gcmp0(p2) && !divise(discsr(p2),p)) { return 1; } ct--; } return 0;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7b661a855d44c832d0c0bd278f0a3a8020f95952/nffactor.c/clean/src/modules/nffactor.c
p=addis(p,1);
is_sqf(GEN nf, GEN polbase){ GEN lt, pr, prh, p2, p; long i, d = lgef(polbase), ct = 3; lt = (GEN)leading_term(polbase)[1]; while (ct > 0) { /* small primes tend to divide discriminants more often than large ones so we look at primes >= 101 */ pr = choose_prime(nf,lt,stoi(101),30); if (!pr) break; p=(GEN)pr[1]; prh=prime_to_ideal(nf,pr); p2=gcopy(polbase); lt=mpinvmod(lt,p); for (i=2; i<d; i++) p2[i] = nfreducemodpr_i(gmul(lt,(GEN)p2[i]), prh)[1]; p2 = normalizepol(p2); /* discriminant is non-zero => polynomial is square-free */ if (!gcmp0(p2) && !divise(discsr(p2),p)) { return 1; } ct--; } return 0;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7b661a855d44c832d0c0bd278f0a3a8020f95952/nffactor.c/clean/src/modules/nffactor.c
unsigned32 name;
uint32_t name;
int rtems_gdb_stub_get_thread_info( int thread, struct rtems_gdb_stub_thread_info *info){ Objects_Id thread_obj_id; Objects_Id min_id, max_id; int first_posix_id, first_rtems_id; Objects_Information *obj_info; Thread_Control *th; unsigned32 name; char tmp_buf[20]; ASSERT(info != NULL); if (thread <= 0) { return 0; } if (_System_state_Get() != SYSTEM_STATE_UP || thread == 1) { /* We have one thread let us use value which will never happen for real thread */ strcpy(info->display, "idle thread"); strcpy(info->name, "IDLE"); info->more_display[0] = 0; /* Nothing */ return 1; } /* Let us get object associtated with current thread */ thread_obj_id = _Thread_Executing->Object.id; /* Let us figure out thread_id for gdb */ first_rtems_id = 2; obj_info = _Objects_Information_table[OBJECTS_CLASSIC_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; if (thread <= (first_rtems_id + (max_id - min_id))) { th = (Thread_Control *)(obj_info->local_table[thread - first_rtems_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "rtems task: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf);#if 0 name = *(unsigned32 *)(obj_info->local_table[thread]->name);#else name = *(unsigned32 *)(obj_info->local_table[thread - first_rtems_id + 1]->name);#endif info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1; } first_posix_id = first_rtems_id + (max_id - min_id) + 1; obj_info = _Objects_Information_table[OBJECTS_POSIX_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; th = (Thread_Control *)(obj_info->local_table[thread - first_posix_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "posix thread: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf); name = *(unsigned32 *)(obj_info->local_table[thread - first_posix_id + 1]->name); info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a2ac7e100a2a3b061e8afe0d15d8867ce4abe63e/rtems-stub-glue.c/clean/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
name = *(unsigned32 *)(obj_info->local_table[thread]->name);
name = *(uint32_t*)(obj_info->local_table[thread]->name);
int rtems_gdb_stub_get_thread_info( int thread, struct rtems_gdb_stub_thread_info *info){ Objects_Id thread_obj_id; Objects_Id min_id, max_id; int first_posix_id, first_rtems_id; Objects_Information *obj_info; Thread_Control *th; unsigned32 name; char tmp_buf[20]; ASSERT(info != NULL); if (thread <= 0) { return 0; } if (_System_state_Get() != SYSTEM_STATE_UP || thread == 1) { /* We have one thread let us use value which will never happen for real thread */ strcpy(info->display, "idle thread"); strcpy(info->name, "IDLE"); info->more_display[0] = 0; /* Nothing */ return 1; } /* Let us get object associtated with current thread */ thread_obj_id = _Thread_Executing->Object.id; /* Let us figure out thread_id for gdb */ first_rtems_id = 2; obj_info = _Objects_Information_table[OBJECTS_CLASSIC_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; if (thread <= (first_rtems_id + (max_id - min_id))) { th = (Thread_Control *)(obj_info->local_table[thread - first_rtems_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "rtems task: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf);#if 0 name = *(unsigned32 *)(obj_info->local_table[thread]->name);#else name = *(unsigned32 *)(obj_info->local_table[thread - first_rtems_id + 1]->name);#endif info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1; } first_posix_id = first_rtems_id + (max_id - min_id) + 1; obj_info = _Objects_Information_table[OBJECTS_POSIX_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; th = (Thread_Control *)(obj_info->local_table[thread - first_posix_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "posix thread: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf); name = *(unsigned32 *)(obj_info->local_table[thread - first_posix_id + 1]->name); info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a2ac7e100a2a3b061e8afe0d15d8867ce4abe63e/rtems-stub-glue.c/clean/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
name = *(unsigned32 *)(obj_info->local_table[thread -
name = *(uint32_t*)(obj_info->local_table[thread -
int rtems_gdb_stub_get_thread_info( int thread, struct rtems_gdb_stub_thread_info *info){ Objects_Id thread_obj_id; Objects_Id min_id, max_id; int first_posix_id, first_rtems_id; Objects_Information *obj_info; Thread_Control *th; unsigned32 name; char tmp_buf[20]; ASSERT(info != NULL); if (thread <= 0) { return 0; } if (_System_state_Get() != SYSTEM_STATE_UP || thread == 1) { /* We have one thread let us use value which will never happen for real thread */ strcpy(info->display, "idle thread"); strcpy(info->name, "IDLE"); info->more_display[0] = 0; /* Nothing */ return 1; } /* Let us get object associtated with current thread */ thread_obj_id = _Thread_Executing->Object.id; /* Let us figure out thread_id for gdb */ first_rtems_id = 2; obj_info = _Objects_Information_table[OBJECTS_CLASSIC_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; if (thread <= (first_rtems_id + (max_id - min_id))) { th = (Thread_Control *)(obj_info->local_table[thread - first_rtems_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "rtems task: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf);#if 0 name = *(unsigned32 *)(obj_info->local_table[thread]->name);#else name = *(unsigned32 *)(obj_info->local_table[thread - first_rtems_id + 1]->name);#endif info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1; } first_posix_id = first_rtems_id + (max_id - min_id) + 1; obj_info = _Objects_Information_table[OBJECTS_POSIX_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; th = (Thread_Control *)(obj_info->local_table[thread - first_posix_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "posix thread: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf); name = *(unsigned32 *)(obj_info->local_table[thread - first_posix_id + 1]->name); info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a2ac7e100a2a3b061e8afe0d15d8867ce4abe63e/rtems-stub-glue.c/clean/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
name = *(unsigned32 *)(obj_info->local_table[thread -
name = *(uint32_t*)(obj_info->local_table[thread -
int rtems_gdb_stub_get_thread_info( int thread, struct rtems_gdb_stub_thread_info *info){ Objects_Id thread_obj_id; Objects_Id min_id, max_id; int first_posix_id, first_rtems_id; Objects_Information *obj_info; Thread_Control *th; unsigned32 name; char tmp_buf[20]; ASSERT(info != NULL); if (thread <= 0) { return 0; } if (_System_state_Get() != SYSTEM_STATE_UP || thread == 1) { /* We have one thread let us use value which will never happen for real thread */ strcpy(info->display, "idle thread"); strcpy(info->name, "IDLE"); info->more_display[0] = 0; /* Nothing */ return 1; } /* Let us get object associtated with current thread */ thread_obj_id = _Thread_Executing->Object.id; /* Let us figure out thread_id for gdb */ first_rtems_id = 2; obj_info = _Objects_Information_table[OBJECTS_CLASSIC_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; if (thread <= (first_rtems_id + (max_id - min_id))) { th = (Thread_Control *)(obj_info->local_table[thread - first_rtems_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "rtems task: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf);#if 0 name = *(unsigned32 *)(obj_info->local_table[thread]->name);#else name = *(unsigned32 *)(obj_info->local_table[thread - first_rtems_id + 1]->name);#endif info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1; } first_posix_id = first_rtems_id + (max_id - min_id) + 1; obj_info = _Objects_Information_table[OBJECTS_POSIX_API][1]; min_id = obj_info->minimum_id; max_id = obj_info->maximum_id; th = (Thread_Control *)(obj_info->local_table[thread - first_posix_id + 1]); if (th == NULL) { /* Thread does not exist */ return 0; } strcpy(info->display, "posix thread: control at 0x"); tmp_buf[0] = gdb_hexchars[(((int)th) >> 28) & 0xf]; tmp_buf[1] = gdb_hexchars[(((int)th) >> 24) & 0xf]; tmp_buf[2] = gdb_hexchars[(((int)th) >> 20) & 0xf]; tmp_buf[3] = gdb_hexchars[(((int)th) >> 16) & 0xf]; tmp_buf[4] = gdb_hexchars[(((int)th) >> 12) & 0xf]; tmp_buf[5] = gdb_hexchars[(((int)th) >> 8) & 0xf]; tmp_buf[6] = gdb_hexchars[(((int)th) >> 4) & 0xf]; tmp_buf[7] = gdb_hexchars[((int)th) & 0xf]; tmp_buf[8] = 0; strcat(info->display, tmp_buf); name = *(unsigned32 *)(obj_info->local_table[thread - first_posix_id + 1]->name); info->name[0] = (name >> 24) & 0xff; info->name[1] = (name >> 16) & 0xff; info->name[2] = (name >> 8) & 0xff; info->name[3] = name & 0xff; info->name[4] = 0; info->more_display[0] = 0; /* Nothing */ return 1;}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a2ac7e100a2a3b061e8afe0d15d8867ce4abe63e/rtems-stub-glue.c/clean/c/src/lib/libbsp/shared/gdbstub/rtems-stub-glue.c
fprintferr(ch); flusherr();
parse_texmacs_command(tm_cmd *c, char *ch){ long l = strlen(ch); char *t, *s = ch, *send = s+l-1; growarray A;fprintferr(ch); flusherr(); if (*s != DATA_BEGIN || *send-- != DATA_END) err(talker, "missing DATA_[BEGIN | END] in TeXmacs command"); s++; if (strncmp(s, "special:", 8)) err(talker, "unrecognized TeXmacs command"); s += 8; if (*s != '(' || *send-- != ')') err(talker, "missing enclosing parentheses for TeXmacs command"); s++; t = s; skip_alpha(s); c->cmd = pari_strndup(t, s - t); grow_init(&A); for (c->n = 0; s <= send; c->n++) { char *u = gpmalloc(strlen(s) + 1); skip_space(s); if (*s == '"') s = readstring(s, u); { t = s; while (isdigit((int)*s)) s++; strncpy(u, t, s - t); } grow_append(&A, (void*)u); } c->v = (char**)A.v;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e76ff0f93b535a6d8e16e5c5fd873c2022f2775c/gp.c/clean/src/gp/gp.c
{
else { /* read integer */
parse_texmacs_command(tm_cmd *c, char *ch){ long l = strlen(ch); char *t, *s = ch, *send = s+l-1; growarray A;fprintferr(ch); flusherr(); if (*s != DATA_BEGIN || *send-- != DATA_END) err(talker, "missing DATA_[BEGIN | END] in TeXmacs command"); s++; if (strncmp(s, "special:", 8)) err(talker, "unrecognized TeXmacs command"); s += 8; if (*s != '(' || *send-- != ')') err(talker, "missing enclosing parentheses for TeXmacs command"); s++; t = s; skip_alpha(s); c->cmd = pari_strndup(t, s - t); grow_init(&A); for (c->n = 0; s <= send; c->n++) { char *u = gpmalloc(strlen(s) + 1); skip_space(s); if (*s == '"') s = readstring(s, u); { t = s; while (isdigit((int)*s)) s++; strncpy(u, t, s - t); } grow_append(&A, (void*)u); } c->v = (char**)A.v;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e76ff0f93b535a6d8e16e5c5fd873c2022f2775c/gp.c/clean/src/gp/gp.c
strncpy(u, t, s - t);
strncpy(u, t, s - t); u[s-t] = 0;
parse_texmacs_command(tm_cmd *c, char *ch){ long l = strlen(ch); char *t, *s = ch, *send = s+l-1; growarray A;fprintferr(ch); flusherr(); if (*s != DATA_BEGIN || *send-- != DATA_END) err(talker, "missing DATA_[BEGIN | END] in TeXmacs command"); s++; if (strncmp(s, "special:", 8)) err(talker, "unrecognized TeXmacs command"); s += 8; if (*s != '(' || *send-- != ')') err(talker, "missing enclosing parentheses for TeXmacs command"); s++; t = s; skip_alpha(s); c->cmd = pari_strndup(t, s - t); grow_init(&A); for (c->n = 0; s <= send; c->n++) { char *u = gpmalloc(strlen(s) + 1); skip_space(s); if (*s == '"') s = readstring(s, u); { t = s; while (isdigit((int)*s)) s++; strncpy(u, t, s - t); } grow_append(&A, (void*)u); } c->v = (char**)A.v;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/e76ff0f93b535a6d8e16e5c5fd873c2022f2775c/gp.c/clean/src/gp/gp.c
char new_name[ NAME_MAX + 1 ];
char new_name[ IMFS_NAME_MAX + 1 ];
int IMFS_symlink( rtems_filesystem_location_info_t *parent_loc, const char *link_name, const char *node_name){ IMFS_types_union info; IMFS_jnode_t *new_node; char new_name[ NAME_MAX + 1 ]; int i; /* * Remove any separators at the end of the string. */ IMFS_get_token( node_name, new_name, &i ); info.sym_link.name = link_name; /* * Create a new link node. */ new_node = IMFS_create_node( parent_loc, IMFS_SYM_LINK, new_name, ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), &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_symlink.c/buggy/c/src/lib/libc/imfs_symlink.c
u_short ether_type, *checksum;
u_short ether_type; #ifdef NS u_short *checksum; #endif
ether_input(ifp, eh, m) struct ifnet *ifp; register struct ether_header *eh; struct mbuf *m;{ register struct ifqueue *inq; u_short ether_type, *checksum; int s;#if defined (ISO) || defined (LLC) || defined(NETATALK) register struct llc *l;#endif if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); return; } ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh); if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost, sizeof(etherbroadcastaddr)) == 0) m->m_flags |= M_BCAST; else if (eh->ether_dhost[0] & 1) m->m_flags |= M_MCAST; if (m->m_flags & (M_BCAST|M_MCAST)) ifp->if_imcasts++; ether_type = ntohs(eh->ether_type); switch (ether_type) {#ifdef INET case ETHERTYPE_IP: schednetisr(NETISR_IP); inq = &ipintrq; break; case ETHERTYPE_ARP: schednetisr(NETISR_ARP); inq = &arpintrq; break;#endif#ifdef IPX case ETHERTYPE_IPX: schednetisr(NETISR_IPX); inq = &ipxintrq; break;#endif#ifdef NS case 0x8137: /* Novell Ethernet_II Ethernet TYPE II */ schednetisr(NETISR_NS); inq = &nsintrq; break;#endif /* NS */#ifdef NETATALK case ETHERTYPE_AT: schednetisr(NETISR_ATALK); inq = &atintrq1; break; case ETHERTYPE_AARP: /* probably this should be done with a NETISR as well */ aarpinput((struct arpcom *)ifp, m); /* XXX */ return;#endif NETATALK default:#ifdef NS checksum = mtod(m, ushort *); /* Novell 802.3 */ if ((ether_type <= ETHERMTU) && ((*checksum == 0xffff) || (*checksum == 0xE0E0))){ if(*checksum == 0xE0E0) { m->m_pkthdr.len -= 3; m->m_len -= 3; m->m_data += 3; } schednetisr(NETISR_NS); inq = &nsintrq; break; }#endif /* NS */#if defined (ISO) || defined (LLC) || defined(NETATALK) if (ether_type > ETHERMTU) goto dropanyway; l = mtod(m, struct llc *); switch (l->llc_dsap) {#ifdef NETATALK case LLC_SNAP_LSAP: switch (l->llc_control) { case LLC_UI: if (l->llc_ssap != LLC_SNAP_LSAP) goto dropanyway; if (Bcmp(&(l->llc_snap_org_code)[0], at_org_code, sizeof(at_org_code)) == 0 && ntohs(l->llc_snap_ether_type) == ETHERTYPE_AT) { inq = &atintrq2; m_adj( m, sizeof( struct llc )); schednetisr(NETISR_ATALK); break; } if (Bcmp(&(l->llc_snap_org_code)[0], aarp_org_code, sizeof(aarp_org_code)) == 0 && ntohs(l->llc_snap_ether_type) == ETHERTYPE_AARP) { m_adj( m, sizeof( struct llc )); aarpinput((struct arpcom *)ifp, m); /* XXX */ return; } default: goto dropanyway; } break;#endif NETATALK #ifdef ISO case LLC_ISO_LSAP: switch (l->llc_control) { case LLC_UI: /* LLC_UI_P forbidden in class 1 service */ if ((l->llc_dsap == LLC_ISO_LSAP) && (l->llc_ssap == LLC_ISO_LSAP)) { /* LSAP for ISO */ if (m->m_pkthdr.len > ether_type) m_adj(m, ether_type - m->m_pkthdr.len); m->m_data += 3; /* XXX */ m->m_len -= 3; /* XXX */ m->m_pkthdr.len -= 3; /* XXX */ M_PREPEND(m, sizeof *eh, M_DONTWAIT); if (m == 0) return; *mtod(m, struct ether_header *) = *eh; IFDEBUG(D_ETHER) printf("clnp packet"); ENDDEBUG schednetisr(NETISR_ISO); inq = &clnlintrq; break; } goto dropanyway; case LLC_XID: case LLC_XID_P: if(m->m_len < 6) goto dropanyway; l->llc_window = 0; l->llc_fid = 9; l->llc_class = 1; l->llc_dsap = l->llc_ssap = 0; /* Fall through to */ case LLC_TEST: case LLC_TEST_P: { struct sockaddr sa; register struct ether_header *eh2; int i; u_char c = l->llc_dsap; l->llc_dsap = l->llc_ssap; l->llc_ssap = c; if (m->m_flags & (M_BCAST | M_MCAST)) bcopy((caddr_t)ac->ac_enaddr, (caddr_t)eh->ether_dhost, 6); sa.sa_family = AF_UNSPEC; sa.sa_len = sizeof(sa); eh2 = (struct ether_header *)sa.sa_data; for (i = 0; i < 6; i++) { eh2->ether_shost[i] = c = eh->ether_dhost[i]; eh2->ether_dhost[i] = eh->ether_dhost[i] = eh->ether_shost[i]; eh->ether_shost[i] = c; } ifp->if_output(ifp, m, &sa, NULL); return; } default: m_freem(m); return; } break;#endif /* ISO */#ifdef LLC case LLC_X25_LSAP: { if (m->m_pkthdr.len > ether_type) m_adj(m, ether_type - m->m_pkthdr.len); M_PREPEND(m, sizeof(struct sdl_hdr) , M_DONTWAIT); if (m == 0) return; if ( !sdl_sethdrif(ifp, eh->ether_shost, LLC_X25_LSAP, eh->ether_dhost, LLC_X25_LSAP, 6, mtod(m, struct sdl_hdr *))) panic("ETHER cons addr failure"); mtod(m, struct sdl_hdr *)->sdlhdr_len = ether_type;#ifdef LLC_DEBUG printf("llc packet\n");#endif /* LLC_DEBUG */ schednetisr(NETISR_CCITT); inq = &llcintrq; break; }#endif /* LLC */ dropanyway: default: m_freem(m); return; }#else /* ISO || LLC || NETATALK */ m_freem(m); return;#endif /* ISO || LLC || NETATALK */ } s = splimp(); if (IF_QFULL(inq)) { IF_DROP(inq); m_freem(m); } else IF_ENQUEUE(inq, m); splx(s);}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/if_ethersubr.c/buggy/c/src/libnetworking/net/if_ethersubr.c
char new_name[ NAME_MAX + 1 ];
char new_name[ IMFS_NAME_MAX + 1 ];
int IMFS_symlink( rtems_filesystem_location_info_t *parent_loc, const char *link_name, const char *node_name){ IMFS_types_union info; IMFS_jnode_t *new_node; char new_name[ NAME_MAX + 1 ]; int i; /* * Remove any separators at the end of the string. */ IMFS_get_token( node_name, new_name, &i ); info.sym_link.name = link_name; /* * Create a new link node. */ new_node = IMFS_create_node( parent_loc, IMFS_SYM_LINK, new_name, ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), &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_symlink.c/buggy/c/src/exec/libfs/src/imfs/imfs_symlink.c
look_eta(GEN eta, int pk, GEN z)
look_eta(GEN eta, long pk, GEN z)
look_eta(GEN eta, int pk, GEN z){ long i; for (i=1; i<=pk; i++) if (gequal(z, (GEN)eta[i])) return i-1; return -1;}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c
chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm);
chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm);
nilord2(GEN p, GEN fx, long mf, GEN gx){ long Fa, La, Ea, oE, Fg, eq, er, v = varn(fx), i, nv, Le, Ee, N, l, vn; GEN p1, alph, chi, nu, w, phi, pmf, pdr, pmr, kapp, pie, chib; GEN gamm, chig, nug, delt, beta, eta, chie, nue, pia, vb, opa; if (DEBUGLEVEL >= 3) { fprintferr(" entering Nilord2"); if (DEBUGLEVEL >= 5) { fprintferr(" with parameters: p = %Z, expo = %ld\n", p, mf); fprintferr(" fx = %Z, gx = %Z", fx, gx); } fprintferr("\n"); } /* this is quite arbitrary; what is important is that >= mf + 1 */ pmf = gpuigs(p, mf + 3); pdr = respm(fx, derivpol(fx), pmf); pmr = mulii(sqri(pdr), p); pdr = mulii(p, pdr); chi = polmodi_keep(fx, pmr); alph = polx[v]; nu = gx; N = degree(fx); oE = 0; opa = NULL; for(;;) { /* kappa need to be recomputed */ kapp = NULL; Fa = degree(nu); /* the prime element in Zp[alpha] */ pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); if (Ea < oE) { alph = gadd(alph, opa); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; kapp = NULL; pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); } oE = Ea; opa = pia; if (DEBUGLEVEL >= 5) fprintferr(" Fa = %ld and Ea = %ld \n", Fa, Ea); /* we change alpha such that nu = pia */ if (La > 1) { alph = gadd(alph, eleval(fx, pia, alph)); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; } /* if Ea*Fa == N then O = Zp[alpha] */ if (Ea*Fa == N) { alph = redelt(alph, sqri(p), pmf); return dbasis(p, fx, mf, alph, p); } /* during the process beta tends to a factor of chi */ beta = lift_intern(gpowgs(gmodulcp(nu, chi), Ea)); for (;;) { if (DEBUGLEVEL >= 5) fprintferr(" beta = %Z\n", beta); p1 = gnorm(gmodulcp(beta, chi)); if (signe(p1)) { chib = NULL; vn = ggval(p1, p); eq = (long)(vn / N); er = (long)(vn*Ea/N - eq*Ea); } else { chib = mycaract(chi, beta); vb = vstar(p, chib); eq = (long)(vb[0] / vb[1]); er = (long)(vb[0]*Ea / vb[1] - eq*Ea); } /* the following code can be used to check if beta approximates a factor of chi well enough to derive a factorization of chi. However, in general, the process will always end before this happens. */#if 0 { GEN quo, rem; quo = poldivres(chi, beta, &rem); p1 = content(lift(rem)); fprintferr(" val(rem) = %ld\n", ggval(p1, p)); p1 = respm(beta, quo, pmr); fprintferr(" val(id) = %ld\n", ggval(p1, p)); }#endif /* eq and er are such that gamma = beta.p^-eq.nu^-er is a unit */ if (eq) gamm = gdiv(beta, gpowgs(p, eq)); else gamm = beta; if (er) { /* kappa = nu^-1 in Zp[alpha] */ if (!kapp) { kapp = ginvmod(nu, chi); kapp = redelt(kapp, pmr, pmr); kapp = gmodulcp(kapp, chi); } gamm = lift(gmul(gamm, gpowgs(kapp, er))); gamm = redelt(gamm, p, pmr); } if (DEBUGLEVEL >= 6) fprintferr(" gamma = %Z\n", gamm); if (er || !chib) { p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } else { chig = poleval(chib, gmul(polx[v], gpowgs(p, eq))); chig = gdiv(chig, gpowgs(p, N*eq)); } if (!gcmp1(denom(content(chig)))) { /* the valuation of beta was wrong... This also means that chi_gamma has more than one factor modulo p */ vb = vstar(p, chig); eq = (long)(-vb[0] / vb[1]); er = (long)(-vb[0]*Ea / vb[1] - eq*Ea); if (eq) gamm = gmul(gamm, gpowgs(p, eq)); if (er) { gamm = gmul(gamm, gpowgs(nu, er)); gamm = gmod(gamm, chi); gamm = redelt(gamm, p, pmr); } p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } chig = polmodi(chig, pmr); nug = (GEN)factmod(chig, p)[1]; l = lg(nug) - 1; nug = lift((GEN)nug[l]); if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, gamm, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chig, nug); } Fg = degree(nug); if (Fa%Fg) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Fa\n"); /* we compute a new element such F = lcm(Fa, Fg) */ w = testb2(p, chi, Fa, gamm, Fg); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } /* we look for a root delta of nug in Fp[alpha] such that vp(gamma - delta) > 0. This root can then be used to improved the approximation given by beta */ nv = fetch_var(); w = factmod9(nug, p, gsubst(nu, varn(nu), polx[nv])); w = lift(lift((GEN)w[1])); for (i = 1;; i++) if (degree((GEN)w[i]) == 1) { delt = gneg_i(gsubst(gcoeff(w, 2, i), nv, polx[v])); eta = gsub(gamm, delt); if (typ(delt) == t_INT) { chie = poleval(chig, gadd(polx[v], delt)); chie = polmodi(chie, pmr); nue = (GEN)factmod(chie, p)[1]; l = lg(nue) - 1; nue = lift((GEN)nue[l]); } else { p1 = factcp(p, chi, eta); chie = (GEN)p1[1]; chie = polmodi(chie, pmr); nue = (GEN)p1[2]; l = itos((GEN)p1[3]); } if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ delete_var(); phi = eleval(fx, eta, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chie, nue); } /* if vp(eta) = vp(gamma - delta) > 0 */ if (gegal(nue, polx[v])) break; } delete_var(); pie = getprime(p, chi, eta, chie, nue, &Le, &Ee); if (Ea%Ee) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Ea\n"); pie = redelt(pie, p, pmf); /* we compute a new element such E = lcm(Ea, Ee) */ w = testc2(p, chi, pmr, nu, Ea, pie, Ee); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } if (eq) delt = gmul(delt, gpowgs(p, eq)); if (er) delt = gmul(delt, gpowgs(nu, er)); beta = gsub(beta, delt); } /* we replace alpha by a new alpha with a larger F or E */ alph = eleval(fx, (GEN)w[2], alph); chi = (GEN)w[3]; nu = (GEN)w[4]; w = update_alpha(p, fx, alph, chi, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; /* that can happen if p does not divide the field discriminant! */ if (is_pm1(pmr)) return dbasis(p, fx, mf, alph, chi); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4c9a77502ffece0211181140da4637e2ad1306/base2.c/buggy/src/basemath/base2.c
chie = polmodi(chie, pmr);
nilord2(GEN p, GEN fx, long mf, GEN gx){ long Fa, La, Ea, oE, Fg, eq, er, v = varn(fx), i, nv, Le, Ee, N, l, vn; GEN p1, alph, chi, nu, w, phi, pmf, pdr, pmr, kapp, pie, chib; GEN gamm, chig, nug, delt, beta, eta, chie, nue, pia, vb, opa; if (DEBUGLEVEL >= 3) { fprintferr(" entering Nilord2"); if (DEBUGLEVEL >= 5) { fprintferr(" with parameters: p = %Z, expo = %ld\n", p, mf); fprintferr(" fx = %Z, gx = %Z", fx, gx); } fprintferr("\n"); } /* this is quite arbitrary; what is important is that >= mf + 1 */ pmf = gpuigs(p, mf + 3); pdr = respm(fx, derivpol(fx), pmf); pmr = mulii(sqri(pdr), p); pdr = mulii(p, pdr); chi = polmodi_keep(fx, pmr); alph = polx[v]; nu = gx; N = degree(fx); oE = 0; opa = NULL; for(;;) { /* kappa need to be recomputed */ kapp = NULL; Fa = degree(nu); /* the prime element in Zp[alpha] */ pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); if (Ea < oE) { alph = gadd(alph, opa); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; kapp = NULL; pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); } oE = Ea; opa = pia; if (DEBUGLEVEL >= 5) fprintferr(" Fa = %ld and Ea = %ld \n", Fa, Ea); /* we change alpha such that nu = pia */ if (La > 1) { alph = gadd(alph, eleval(fx, pia, alph)); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; } /* if Ea*Fa == N then O = Zp[alpha] */ if (Ea*Fa == N) { alph = redelt(alph, sqri(p), pmf); return dbasis(p, fx, mf, alph, p); } /* during the process beta tends to a factor of chi */ beta = lift_intern(gpowgs(gmodulcp(nu, chi), Ea)); for (;;) { if (DEBUGLEVEL >= 5) fprintferr(" beta = %Z\n", beta); p1 = gnorm(gmodulcp(beta, chi)); if (signe(p1)) { chib = NULL; vn = ggval(p1, p); eq = (long)(vn / N); er = (long)(vn*Ea/N - eq*Ea); } else { chib = mycaract(chi, beta); vb = vstar(p, chib); eq = (long)(vb[0] / vb[1]); er = (long)(vb[0]*Ea / vb[1] - eq*Ea); } /* the following code can be used to check if beta approximates a factor of chi well enough to derive a factorization of chi. However, in general, the process will always end before this happens. */#if 0 { GEN quo, rem; quo = poldivres(chi, beta, &rem); p1 = content(lift(rem)); fprintferr(" val(rem) = %ld\n", ggval(p1, p)); p1 = respm(beta, quo, pmr); fprintferr(" val(id) = %ld\n", ggval(p1, p)); }#endif /* eq and er are such that gamma = beta.p^-eq.nu^-er is a unit */ if (eq) gamm = gdiv(beta, gpowgs(p, eq)); else gamm = beta; if (er) { /* kappa = nu^-1 in Zp[alpha] */ if (!kapp) { kapp = ginvmod(nu, chi); kapp = redelt(kapp, pmr, pmr); kapp = gmodulcp(kapp, chi); } gamm = lift(gmul(gamm, gpowgs(kapp, er))); gamm = redelt(gamm, p, pmr); } if (DEBUGLEVEL >= 6) fprintferr(" gamma = %Z\n", gamm); if (er || !chib) { p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } else { chig = poleval(chib, gmul(polx[v], gpowgs(p, eq))); chig = gdiv(chig, gpowgs(p, N*eq)); } if (!gcmp1(denom(content(chig)))) { /* the valuation of beta was wrong... This also means that chi_gamma has more than one factor modulo p */ vb = vstar(p, chig); eq = (long)(-vb[0] / vb[1]); er = (long)(-vb[0]*Ea / vb[1] - eq*Ea); if (eq) gamm = gmul(gamm, gpowgs(p, eq)); if (er) { gamm = gmul(gamm, gpowgs(nu, er)); gamm = gmod(gamm, chi); gamm = redelt(gamm, p, pmr); } p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } chig = polmodi(chig, pmr); nug = (GEN)factmod(chig, p)[1]; l = lg(nug) - 1; nug = lift((GEN)nug[l]); if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, gamm, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chig, nug); } Fg = degree(nug); if (Fa%Fg) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Fa\n"); /* we compute a new element such F = lcm(Fa, Fg) */ w = testb2(p, chi, Fa, gamm, Fg); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } /* we look for a root delta of nug in Fp[alpha] such that vp(gamma - delta) > 0. This root can then be used to improved the approximation given by beta */ nv = fetch_var(); w = factmod9(nug, p, gsubst(nu, varn(nu), polx[nv])); w = lift(lift((GEN)w[1])); for (i = 1;; i++) if (degree((GEN)w[i]) == 1) { delt = gneg_i(gsubst(gcoeff(w, 2, i), nv, polx[v])); eta = gsub(gamm, delt); if (typ(delt) == t_INT) { chie = poleval(chig, gadd(polx[v], delt)); chie = polmodi(chie, pmr); nue = (GEN)factmod(chie, p)[1]; l = lg(nue) - 1; nue = lift((GEN)nue[l]); } else { p1 = factcp(p, chi, eta); chie = (GEN)p1[1]; chie = polmodi(chie, pmr); nue = (GEN)p1[2]; l = itos((GEN)p1[3]); } if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ delete_var(); phi = eleval(fx, eta, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chie, nue); } /* if vp(eta) = vp(gamma - delta) > 0 */ if (gegal(nue, polx[v])) break; } delete_var(); pie = getprime(p, chi, eta, chie, nue, &Le, &Ee); if (Ea%Ee) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Ea\n"); pie = redelt(pie, p, pmf); /* we compute a new element such E = lcm(Ea, Ee) */ w = testc2(p, chi, pmr, nu, Ea, pie, Ee); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } if (eq) delt = gmul(delt, gpowgs(p, eq)); if (er) delt = gmul(delt, gpowgs(nu, er)); beta = gsub(beta, delt); } /* we replace alpha by a new alpha with a larger F or E */ alph = eleval(fx, (GEN)w[2], alph); chi = (GEN)w[3]; nu = (GEN)w[4]; w = update_alpha(p, fx, alph, chi, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; /* that can happen if p does not divide the field discriminant! */ if (is_pm1(pmr)) return dbasis(p, fx, mf, alph, chi); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4c9a77502ffece0211181140da4637e2ad1306/base2.c/buggy/src/basemath/base2.c
{
{
nilord2(GEN p, GEN fx, long mf, GEN gx){ long Fa, La, Ea, oE, Fg, eq, er, v = varn(fx), i, nv, Le, Ee, N, l, vn; GEN p1, alph, chi, nu, w, phi, pmf, pdr, pmr, kapp, pie, chib; GEN gamm, chig, nug, delt, beta, eta, chie, nue, pia, vb, opa; if (DEBUGLEVEL >= 3) { fprintferr(" entering Nilord2"); if (DEBUGLEVEL >= 5) { fprintferr(" with parameters: p = %Z, expo = %ld\n", p, mf); fprintferr(" fx = %Z, gx = %Z", fx, gx); } fprintferr("\n"); } /* this is quite arbitrary; what is important is that >= mf + 1 */ pmf = gpuigs(p, mf + 3); pdr = respm(fx, derivpol(fx), pmf); pmr = mulii(sqri(pdr), p); pdr = mulii(p, pdr); chi = polmodi_keep(fx, pmr); alph = polx[v]; nu = gx; N = degree(fx); oE = 0; opa = NULL; for(;;) { /* kappa need to be recomputed */ kapp = NULL; Fa = degree(nu); /* the prime element in Zp[alpha] */ pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); if (Ea < oE) { alph = gadd(alph, opa); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; kapp = NULL; pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); } oE = Ea; opa = pia; if (DEBUGLEVEL >= 5) fprintferr(" Fa = %ld and Ea = %ld \n", Fa, Ea); /* we change alpha such that nu = pia */ if (La > 1) { alph = gadd(alph, eleval(fx, pia, alph)); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; } /* if Ea*Fa == N then O = Zp[alpha] */ if (Ea*Fa == N) { alph = redelt(alph, sqri(p), pmf); return dbasis(p, fx, mf, alph, p); } /* during the process beta tends to a factor of chi */ beta = lift_intern(gpowgs(gmodulcp(nu, chi), Ea)); for (;;) { if (DEBUGLEVEL >= 5) fprintferr(" beta = %Z\n", beta); p1 = gnorm(gmodulcp(beta, chi)); if (signe(p1)) { chib = NULL; vn = ggval(p1, p); eq = (long)(vn / N); er = (long)(vn*Ea/N - eq*Ea); } else { chib = mycaract(chi, beta); vb = vstar(p, chib); eq = (long)(vb[0] / vb[1]); er = (long)(vb[0]*Ea / vb[1] - eq*Ea); } /* the following code can be used to check if beta approximates a factor of chi well enough to derive a factorization of chi. However, in general, the process will always end before this happens. */#if 0 { GEN quo, rem; quo = poldivres(chi, beta, &rem); p1 = content(lift(rem)); fprintferr(" val(rem) = %ld\n", ggval(p1, p)); p1 = respm(beta, quo, pmr); fprintferr(" val(id) = %ld\n", ggval(p1, p)); }#endif /* eq and er are such that gamma = beta.p^-eq.nu^-er is a unit */ if (eq) gamm = gdiv(beta, gpowgs(p, eq)); else gamm = beta; if (er) { /* kappa = nu^-1 in Zp[alpha] */ if (!kapp) { kapp = ginvmod(nu, chi); kapp = redelt(kapp, pmr, pmr); kapp = gmodulcp(kapp, chi); } gamm = lift(gmul(gamm, gpowgs(kapp, er))); gamm = redelt(gamm, p, pmr); } if (DEBUGLEVEL >= 6) fprintferr(" gamma = %Z\n", gamm); if (er || !chib) { p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } else { chig = poleval(chib, gmul(polx[v], gpowgs(p, eq))); chig = gdiv(chig, gpowgs(p, N*eq)); } if (!gcmp1(denom(content(chig)))) { /* the valuation of beta was wrong... This also means that chi_gamma has more than one factor modulo p */ vb = vstar(p, chig); eq = (long)(-vb[0] / vb[1]); er = (long)(-vb[0]*Ea / vb[1] - eq*Ea); if (eq) gamm = gmul(gamm, gpowgs(p, eq)); if (er) { gamm = gmul(gamm, gpowgs(nu, er)); gamm = gmod(gamm, chi); gamm = redelt(gamm, p, pmr); } p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } chig = polmodi(chig, pmr); nug = (GEN)factmod(chig, p)[1]; l = lg(nug) - 1; nug = lift((GEN)nug[l]); if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, gamm, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chig, nug); } Fg = degree(nug); if (Fa%Fg) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Fa\n"); /* we compute a new element such F = lcm(Fa, Fg) */ w = testb2(p, chi, Fa, gamm, Fg); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } /* we look for a root delta of nug in Fp[alpha] such that vp(gamma - delta) > 0. This root can then be used to improved the approximation given by beta */ nv = fetch_var(); w = factmod9(nug, p, gsubst(nu, varn(nu), polx[nv])); w = lift(lift((GEN)w[1])); for (i = 1;; i++) if (degree((GEN)w[i]) == 1) { delt = gneg_i(gsubst(gcoeff(w, 2, i), nv, polx[v])); eta = gsub(gamm, delt); if (typ(delt) == t_INT) { chie = poleval(chig, gadd(polx[v], delt)); chie = polmodi(chie, pmr); nue = (GEN)factmod(chie, p)[1]; l = lg(nue) - 1; nue = lift((GEN)nue[l]); } else { p1 = factcp(p, chi, eta); chie = (GEN)p1[1]; chie = polmodi(chie, pmr); nue = (GEN)p1[2]; l = itos((GEN)p1[3]); } if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ delete_var(); phi = eleval(fx, eta, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chie, nue); } /* if vp(eta) = vp(gamma - delta) > 0 */ if (gegal(nue, polx[v])) break; } delete_var(); pie = getprime(p, chi, eta, chie, nue, &Le, &Ee); if (Ea%Ee) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Ea\n"); pie = redelt(pie, p, pmf); /* we compute a new element such E = lcm(Ea, Ee) */ w = testc2(p, chi, pmr, nu, Ea, pie, Ee); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } if (eq) delt = gmul(delt, gpowgs(p, eq)); if (er) delt = gmul(delt, gpowgs(nu, er)); beta = gsub(beta, delt); } /* we replace alpha by a new alpha with a larger F or E */ alph = eleval(fx, (GEN)w[2], alph); chi = (GEN)w[3]; nu = (GEN)w[4]; w = update_alpha(p, fx, alph, chi, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; /* that can happen if p does not divide the field discriminant! */ if (is_pm1(pmr)) return dbasis(p, fx, mf, alph, chi); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4c9a77502ffece0211181140da4637e2ad1306/base2.c/buggy/src/basemath/base2.c
chie = polmodi(chie, pmr);
nilord2(GEN p, GEN fx, long mf, GEN gx){ long Fa, La, Ea, oE, Fg, eq, er, v = varn(fx), i, nv, Le, Ee, N, l, vn; GEN p1, alph, chi, nu, w, phi, pmf, pdr, pmr, kapp, pie, chib; GEN gamm, chig, nug, delt, beta, eta, chie, nue, pia, vb, opa; if (DEBUGLEVEL >= 3) { fprintferr(" entering Nilord2"); if (DEBUGLEVEL >= 5) { fprintferr(" with parameters: p = %Z, expo = %ld\n", p, mf); fprintferr(" fx = %Z, gx = %Z", fx, gx); } fprintferr("\n"); } /* this is quite arbitrary; what is important is that >= mf + 1 */ pmf = gpuigs(p, mf + 3); pdr = respm(fx, derivpol(fx), pmf); pmr = mulii(sqri(pdr), p); pdr = mulii(p, pdr); chi = polmodi_keep(fx, pmr); alph = polx[v]; nu = gx; N = degree(fx); oE = 0; opa = NULL; for(;;) { /* kappa need to be recomputed */ kapp = NULL; Fa = degree(nu); /* the prime element in Zp[alpha] */ pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); if (Ea < oE) { alph = gadd(alph, opa); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; kapp = NULL; pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); } oE = Ea; opa = pia; if (DEBUGLEVEL >= 5) fprintferr(" Fa = %ld and Ea = %ld \n", Fa, Ea); /* we change alpha such that nu = pia */ if (La > 1) { alph = gadd(alph, eleval(fx, pia, alph)); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; } /* if Ea*Fa == N then O = Zp[alpha] */ if (Ea*Fa == N) { alph = redelt(alph, sqri(p), pmf); return dbasis(p, fx, mf, alph, p); } /* during the process beta tends to a factor of chi */ beta = lift_intern(gpowgs(gmodulcp(nu, chi), Ea)); for (;;) { if (DEBUGLEVEL >= 5) fprintferr(" beta = %Z\n", beta); p1 = gnorm(gmodulcp(beta, chi)); if (signe(p1)) { chib = NULL; vn = ggval(p1, p); eq = (long)(vn / N); er = (long)(vn*Ea/N - eq*Ea); } else { chib = mycaract(chi, beta); vb = vstar(p, chib); eq = (long)(vb[0] / vb[1]); er = (long)(vb[0]*Ea / vb[1] - eq*Ea); } /* the following code can be used to check if beta approximates a factor of chi well enough to derive a factorization of chi. However, in general, the process will always end before this happens. */#if 0 { GEN quo, rem; quo = poldivres(chi, beta, &rem); p1 = content(lift(rem)); fprintferr(" val(rem) = %ld\n", ggval(p1, p)); p1 = respm(beta, quo, pmr); fprintferr(" val(id) = %ld\n", ggval(p1, p)); }#endif /* eq and er are such that gamma = beta.p^-eq.nu^-er is a unit */ if (eq) gamm = gdiv(beta, gpowgs(p, eq)); else gamm = beta; if (er) { /* kappa = nu^-1 in Zp[alpha] */ if (!kapp) { kapp = ginvmod(nu, chi); kapp = redelt(kapp, pmr, pmr); kapp = gmodulcp(kapp, chi); } gamm = lift(gmul(gamm, gpowgs(kapp, er))); gamm = redelt(gamm, p, pmr); } if (DEBUGLEVEL >= 6) fprintferr(" gamma = %Z\n", gamm); if (er || !chib) { p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } else { chig = poleval(chib, gmul(polx[v], gpowgs(p, eq))); chig = gdiv(chig, gpowgs(p, N*eq)); } if (!gcmp1(denom(content(chig)))) { /* the valuation of beta was wrong... This also means that chi_gamma has more than one factor modulo p */ vb = vstar(p, chig); eq = (long)(-vb[0] / vb[1]); er = (long)(-vb[0]*Ea / vb[1] - eq*Ea); if (eq) gamm = gmul(gamm, gpowgs(p, eq)); if (er) { gamm = gmul(gamm, gpowgs(nu, er)); gamm = gmod(gamm, chi); gamm = redelt(gamm, p, pmr); } p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } chig = polmodi(chig, pmr); nug = (GEN)factmod(chig, p)[1]; l = lg(nug) - 1; nug = lift((GEN)nug[l]); if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, gamm, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chig, nug); } Fg = degree(nug); if (Fa%Fg) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Fa\n"); /* we compute a new element such F = lcm(Fa, Fg) */ w = testb2(p, chi, Fa, gamm, Fg); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } /* we look for a root delta of nug in Fp[alpha] such that vp(gamma - delta) > 0. This root can then be used to improved the approximation given by beta */ nv = fetch_var(); w = factmod9(nug, p, gsubst(nu, varn(nu), polx[nv])); w = lift(lift((GEN)w[1])); for (i = 1;; i++) if (degree((GEN)w[i]) == 1) { delt = gneg_i(gsubst(gcoeff(w, 2, i), nv, polx[v])); eta = gsub(gamm, delt); if (typ(delt) == t_INT) { chie = poleval(chig, gadd(polx[v], delt)); chie = polmodi(chie, pmr); nue = (GEN)factmod(chie, p)[1]; l = lg(nue) - 1; nue = lift((GEN)nue[l]); } else { p1 = factcp(p, chi, eta); chie = (GEN)p1[1]; chie = polmodi(chie, pmr); nue = (GEN)p1[2]; l = itos((GEN)p1[3]); } if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ delete_var(); phi = eleval(fx, eta, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chie, nue); } /* if vp(eta) = vp(gamma - delta) > 0 */ if (gegal(nue, polx[v])) break; } delete_var(); pie = getprime(p, chi, eta, chie, nue, &Le, &Ee); if (Ea%Ee) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Ea\n"); pie = redelt(pie, p, pmf); /* we compute a new element such E = lcm(Ea, Ee) */ w = testc2(p, chi, pmr, nu, Ea, pie, Ee); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } if (eq) delt = gmul(delt, gpowgs(p, eq)); if (er) delt = gmul(delt, gpowgs(nu, er)); beta = gsub(beta, delt); } /* we replace alpha by a new alpha with a larger F or E */ alph = eleval(fx, (GEN)w[2], alph); chi = (GEN)w[3]; nu = (GEN)w[4]; w = update_alpha(p, fx, alph, chi, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; /* that can happen if p does not divide the field discriminant! */ if (is_pm1(pmr)) return dbasis(p, fx, mf, alph, chi); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4c9a77502ffece0211181140da4637e2ad1306/base2.c/buggy/src/basemath/base2.c
if (!signe(modii((GEN)chie[2], pmr))) chie = mycaract(chi, eta);
nilord2(GEN p, GEN fx, long mf, GEN gx){ long Fa, La, Ea, oE, Fg, eq, er, v = varn(fx), i, nv, Le, Ee, N, l, vn; GEN p1, alph, chi, nu, w, phi, pmf, pdr, pmr, kapp, pie, chib; GEN gamm, chig, nug, delt, beta, eta, chie, nue, pia, vb, opa; if (DEBUGLEVEL >= 3) { fprintferr(" entering Nilord2"); if (DEBUGLEVEL >= 5) { fprintferr(" with parameters: p = %Z, expo = %ld\n", p, mf); fprintferr(" fx = %Z, gx = %Z", fx, gx); } fprintferr("\n"); } /* this is quite arbitrary; what is important is that >= mf + 1 */ pmf = gpuigs(p, mf + 3); pdr = respm(fx, derivpol(fx), pmf); pmr = mulii(sqri(pdr), p); pdr = mulii(p, pdr); chi = polmodi_keep(fx, pmr); alph = polx[v]; nu = gx; N = degree(fx); oE = 0; opa = NULL; for(;;) { /* kappa need to be recomputed */ kapp = NULL; Fa = degree(nu); /* the prime element in Zp[alpha] */ pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); if (Ea < oE) { alph = gadd(alph, opa); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; kapp = NULL; pia = getprime(p, chi, polx[v], chi, nu, &La, &Ea); pia = redelt(pia, pmr, pmf); } oE = Ea; opa = pia; if (DEBUGLEVEL >= 5) fprintferr(" Fa = %ld and Ea = %ld \n", Fa, Ea); /* we change alpha such that nu = pia */ if (La > 1) { alph = gadd(alph, eleval(fx, pia, alph)); w = update_alpha(p, fx, alph, NULL, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; } /* if Ea*Fa == N then O = Zp[alpha] */ if (Ea*Fa == N) { alph = redelt(alph, sqri(p), pmf); return dbasis(p, fx, mf, alph, p); } /* during the process beta tends to a factor of chi */ beta = lift_intern(gpowgs(gmodulcp(nu, chi), Ea)); for (;;) { if (DEBUGLEVEL >= 5) fprintferr(" beta = %Z\n", beta); p1 = gnorm(gmodulcp(beta, chi)); if (signe(p1)) { chib = NULL; vn = ggval(p1, p); eq = (long)(vn / N); er = (long)(vn*Ea/N - eq*Ea); } else { chib = mycaract(chi, beta); vb = vstar(p, chib); eq = (long)(vb[0] / vb[1]); er = (long)(vb[0]*Ea / vb[1] - eq*Ea); } /* the following code can be used to check if beta approximates a factor of chi well enough to derive a factorization of chi. However, in general, the process will always end before this happens. */#if 0 { GEN quo, rem; quo = poldivres(chi, beta, &rem); p1 = content(lift(rem)); fprintferr(" val(rem) = %ld\n", ggval(p1, p)); p1 = respm(beta, quo, pmr); fprintferr(" val(id) = %ld\n", ggval(p1, p)); }#endif /* eq and er are such that gamma = beta.p^-eq.nu^-er is a unit */ if (eq) gamm = gdiv(beta, gpowgs(p, eq)); else gamm = beta; if (er) { /* kappa = nu^-1 in Zp[alpha] */ if (!kapp) { kapp = ginvmod(nu, chi); kapp = redelt(kapp, pmr, pmr); kapp = gmodulcp(kapp, chi); } gamm = lift(gmul(gamm, gpowgs(kapp, er))); gamm = redelt(gamm, p, pmr); } if (DEBUGLEVEL >= 6) fprintferr(" gamma = %Z\n", gamm); if (er || !chib) { p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } else { chig = poleval(chib, gmul(polx[v], gpowgs(p, eq))); chig = gdiv(chig, gpowgs(p, N*eq)); } if (!gcmp1(denom(content(chig)))) { /* the valuation of beta was wrong... This also means that chi_gamma has more than one factor modulo p */ vb = vstar(p, chig); eq = (long)(-vb[0] / vb[1]); er = (long)(-vb[0]*Ea / vb[1] - eq*Ea); if (eq) gamm = gmul(gamm, gpowgs(p, eq)); if (er) { gamm = gmul(gamm, gpowgs(nu, er)); gamm = gmod(gamm, chi); gamm = redelt(gamm, p, pmr); } p1 = mulii(pdr, ggcd(denom(content(gamm)), pdr)); chig = mycaract(redelt(chi, mulii(pdr, p1), pdr), gamm); } chig = polmodi(chig, pmr); nug = (GEN)factmod(chig, p)[1]; l = lg(nug) - 1; nug = lift((GEN)nug[l]); if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, gamm, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chig, nug); } Fg = degree(nug); if (Fa%Fg) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Fa\n"); /* we compute a new element such F = lcm(Fa, Fg) */ w = testb2(p, chi, Fa, gamm, Fg); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } /* we look for a root delta of nug in Fp[alpha] such that vp(gamma - delta) > 0. This root can then be used to improved the approximation given by beta */ nv = fetch_var(); w = factmod9(nug, p, gsubst(nu, varn(nu), polx[nv])); w = lift(lift((GEN)w[1])); for (i = 1;; i++) if (degree((GEN)w[i]) == 1) { delt = gneg_i(gsubst(gcoeff(w, 2, i), nv, polx[v])); eta = gsub(gamm, delt); if (typ(delt) == t_INT) { chie = poleval(chig, gadd(polx[v], delt)); chie = polmodi(chie, pmr); nue = (GEN)factmod(chie, p)[1]; l = lg(nue) - 1; nue = lift((GEN)nue[l]); } else { p1 = factcp(p, chi, eta); chie = (GEN)p1[1]; chie = polmodi(chie, pmr); nue = (GEN)p1[2]; l = itos((GEN)p1[3]); } if (l > 1) { /* there are at least 2 factors mod. p => chi can be split */ delete_var(); phi = eleval(fx, eta, alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, chie, nue); } /* if vp(eta) = vp(gamma - delta) > 0 */ if (gegal(nue, polx[v])) break; } delete_var(); pie = getprime(p, chi, eta, chie, nue, &Le, &Ee); if (Ea%Ee) { if (DEBUGLEVEL >= 5) fprintferr(" Increasing Ea\n"); pie = redelt(pie, p, pmf); /* we compute a new element such E = lcm(Ea, Ee) */ w = testc2(p, chi, pmr, nu, Ea, pie, Ee); if (gcmp1((GEN)w[1])) { /* there are at least 2 factors mod. p => chi can be split */ phi = eleval(fx, (GEN)w[2], alph); phi = redelt(phi, p, pmf); return Decomp(p, fx, mf, phi, (GEN)w[3], (GEN)w[4]); } break; } if (eq) delt = gmul(delt, gpowgs(p, eq)); if (er) delt = gmul(delt, gpowgs(nu, er)); beta = gsub(beta, delt); } /* we replace alpha by a new alpha with a larger F or E */ alph = eleval(fx, (GEN)w[2], alph); chi = (GEN)w[3]; nu = (GEN)w[4]; w = update_alpha(p, fx, alph, chi, pmr, pmf, mf); alph = (GEN)w[1]; chi = (GEN)w[2]; pmr = (GEN)w[3]; pdr = (GEN)w[4]; /* that can happen if p does not divide the field discriminant! */ if (is_pm1(pmr)) return dbasis(p, fx, mf, alph, chi); }}
2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4c9a77502ffece0211181140da4637e2ad1306/base2.c/buggy/src/basemath/base2.c
void mips_vector_isr_handlers( void )
void mips_vector_isr_handlers( CPU_Interrupt_frame *frame )
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr;
unsigned32 sr, srmaskoff; unsigned32 cause, cshifted; unsigned32 bit; unsigned32 pf_icr;
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
mips_get_sr( sr );
/* mips_get_sr( sr ); */ sr = frame->regs[ R_SR ];
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT;
/* mask off everything other than the interrupt bits */ cause &= SR_IMASK;
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 );
/* mask off the pending interrupts in the status register */ srmaskoff = sr & ~cause; mips_set_sr( srmaskoff ); /* allow nesting for all non-pending interrupts */ asm volatile( "rfe" ); cshifted = (cause & (sr & SR_IMASK)) >> CAUSE_IPSHIFT; if ( cshifted & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1, frame );
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 );
if ( cshifted & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2, frame );
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c
if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 );
if ( cshifted & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2, frame );
void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );}
10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c