pfzlz / pgapack

Automatically exported from code.google.com/p/pgapack
Other
0 stars 0 forks source link

Uninitialized ctx->sys.UserFortran #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was tracking an erratic problem with a c++ program using pgapack. Turns out 
the problem is that pgapack uses ctx->sys.UserFortran uninitialized in 
PGACreate() in create.c.

Adding 'ctx->sys.UserFortran = PGA_FALSE;' right after the call to malloc() 
(i.e. after the NULL pointer check) fixes the problem.

Alternatively the call to malloc() can be replaced by a call to calloc().

The problem is very hard to reproduce as PGACreate() sets ctx->sys.UserFortran 
to PGA_FALSE if it has any value other than PGA_FALSE and PGA_TRUE. Therefore 
the bug is only exposed in rare cases.

Original issue reported on code.google.com by Clifford...@gmail.com on 16 Jul 2013 at 8:06

GoogleCodeExporter commented 9 years ago
A 2nd look at create.c and f2c.c gives me the impression that the if statement 
in create.c:286 is only there for historic reasons and the assignment of 
ctx->sys.UserFortran in create.c:287 should simply be unconditional.

Original comment by Clifford...@gmail.com on 16 Jul 2013 at 8:32