Description of problem: postgresql is failing its regression tests in rawhide since about two days ago. Debugging the problem reveals that an error-handling chunk of code reached by setjmp() is failing to restore a global variable that it is supposed to restore. Normally I would think that this is a gcc issue, especially since it goes away at -O0. But gcc hasn't changed recently and the appearance of the problem coincides with the introduction of glibc-2.14.90-15.1 into rawhide. So I'm wondering if longjmp is now forgetting to restore some registers, or something like that. Version-Release number of selected component (if applicable): glibc-2.14.90-15.1 How reproducible: 100% Steps to Reproduce: 1. Try to build current postgresql SRPM (9.1.1-2) Actual results: Regression test failure for plpython module --- it prints one line that it shouldn't. Expected results: No failure. Additional info: Failure is observed on both x86_64 and i386 architectures. The problematic code looks approximately like this: static PLyProcedure *PLy_curr_procedure = NULL; Datum plpython_call_handler(FunctionCallInfo fcinfo) { PLyProcedure *save_curr_proc; save_curr_proc = PLy_curr_procedure; do { sigjmp_buf *save_exception_stack = PG_exception_stack; sigjmp_buf local_sigjmp_buf; if (__sigsetjmp (local_sigjmp_buf, 0) == 0) { PG_exception_stack = &local_sigjmp_buf; ... } else { PG_exception_stack = save_exception_stack; PLy_curr_procedure = save_curr_proc; // this assignment is getting lost PyErr_Clear(); pg_re_throw(); // this does a longjmp(), so it doesn't return } PG_exception_stack = save_exception_stack; } while (0); PLy_curr_procedure = save_curr_proc; ... } and the observed behavior is that PLy_curr_procedure isn't getting restored during a longjmp exit.
PLy_curr_procedure is in static storage, so its value would not be restored -- it will contain whatever value it had when longjmp was called. So the assignment to pLy_curr_procedure = save_curr_proc would be lost if there were any later assignments to PLy_curr_procedure. Jeff
I'm not expecting longjmp to restore the value --- I'm expecting the explicit assignment to handle that. After some inspection of the generated assembly code, I've concluded that this is indeed a gcc issue not a glibc issue; it's simply not generating the assignment. Not sure why we didn't see it before the glibc update, but anyway I will refile this over there; sorry for the false alarm.
I was kindof wondering if underneath it all GCC omitted the store, I was pretty sure you knew setjmp/longjmp semantics. Odd that it only showed up now... Either way it's my team that'll own it, so it's not a false alarm, just different folks within the team that'll be charged with fixing it. If you could pass along the .i/.ii file, compile options and since you've identified the missing store, whatever comments you have on the resulting assembly, that'd be a huge help to the GCC engineer ultimately assigned to fix the problem.
Done at bug #752905.