Hi,

I'm Thanh Vo. I've been using gdb to debug some numeric code and I've
run into puzzling behavior that appears to be sensitive to the order
of the inputs.

Attached is the source of a test program and 2 set of inputs. The
inputs only differ in the order of arguments.

Run on the test program with its arguments set to the first ordering
of the inputs, gdb outputs the source line of the floating point
operation that triggers an exception.  On the second ordering,
however, gdb hangs.

Any idea what is going on here and how I can fix it?

Best regards,
Thanh Vo.
-33376107877608015805697032347520619197600311024721253807701885110060422266351947931059174683100146655462646479605613367111639557966124592366273082221267818329213709795161253694187020308524709262620651797214316519125939268192112452019372320356715832049685001469993536806935400374255968142732575043863585861996507490196863315978341459173427383616321159957186423231925335875225480418185856812615600053065167740799642051187261847433103358611411579939228395444949756528494697155974350726232403827948835393/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 
5562684646268003457725581793331010160548039951155829576383318542218011087034795489635707897531277551410168349327589527512881085403883650272140030963444297052826944983830005826199025368606459090179803912617356259335520938127016626541645397371801227949921479099121251589771925295762186999452219384374873628951129012627288499641456177046612783844839512480289952714415129981083380285880975371989249023978222229007481603777658665783484158693966282573429405118314079453714160877180307071594105112117028519/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
5562684646268003457725581793331010160548039951155829576383318542218011087034795489635707897531277551410168349327589527512881085403883650272140030963444297052826944983830005826199025368606459090179803912617356259335520938127016626541645397371801227949921479099121251589771925295762186999452219384374873628951129012627288499641456177046612783844839512480289952714415129981083380285880975371989249023978222229007481603777658665783484158693966282573429405118314079453714160877180307071594105112117028519/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 
-33376107877608015805697032347520619197600311024721253807701885110060422266351947931059174683100146655462646479605613367111639557966124592366273082221267818329213709795161253694187020308524709262620651797214316519125939268192112452019372320356715832049685001469993536806935400374255968142732575043863585861996507490196863315978341459173427383616321159957186423231925335875225480418185856812615600053065167740799642051187261847433103358611411579939228395444949756528494697155974350726232403827948835393/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
#include <stdio.h>
#include <gmp.h>
#include <fenv.h>
double fadd (double x, double y) {
  return (x + y);
}

int main(int argc, char* argv[])
{  
  double x, y, z;
  mpq_t tmp;
  mpq_init(tmp);
  mpq_set_str(tmp,argv[1],10);
  x = mpq_get_d(tmp);
  mpq_set_str(tmp,argv[2],10);
  y = mpq_get_d(tmp);
  feenableexcept (
	FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW
  );
  z = fadd(x,y);
  printf("%e\n",z);  
  return 0;
}
_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-gdb

Reply via email to