From Bugzilla Helper: User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (Win98; I) Description of problem: Hello there, I just tried to compile package rpm-4.1-1.06 from Redhat 8.0 The compiler said ../db/db_load/db_load.c:810: warning: operation on `instr' may be undefined Here is an untested patch to shut up the compiler. *** ./db/db_load/db_load.c.old 2003-01-18 14:36:07.000000000 +0000 --- ./db/db_load/db_load.c 2003-01-18 14:36:32.000000000 +0000 *************** *** 806,813 **** *outstr++ = '\\'; continue; } ! c = digitize(dbenv, *instr, &e1) << 4 | ! digitize(dbenv, *++instr, &e2); if (e1 || e2) { badend(dbenv); return (EINVAL); --- 806,814 ---- *outstr++ = '\\'; continue; } ! c = digitize(dbenv, instr[ 0], &e1) << 4 | ! digitize(dbenv, instr[ 1], &e2); ! ++instr; if (e1 || e2) { badend(dbenv); return (EINVAL); Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. compile the program 2. 3. Additional info
Same code compiles w/o warning using gcc-3.2.1.
try compiling with C compiler flags "-g -O2 -Wall". Then you should see the problem. You appear to have not read the source code I pointed out. It is clearly wrong, merely by inspection.
I *did* compile with -Wall, and several other checks, but am almost certainly using a different compiler. Yes, the source code looks "fishy", but that's a Berkeley DB problem, not an rpm problem. I choose to stay as close as possible to pristine Berkeley DB.
>I *did* compile with -Wall, and several other checks, >but am almost certainly using a different compiler. You may have compiled with -Wall, but you didn't use 3.2.1 as well. Try using 3.2.1 *and* "-g -O2 -Wall" to reproduce my bug report. >Yes, the source code looks "fishy", but that's a >Berkeley DB problem, not an rpm problem. I choose >to stay as close as possible to pristine Berkeley DB. What you describe as "fishy" is undefined code. I strongly recommend reading section 2.12 of K&R 2. Page 52 in my copy. You might stay as close as you like to Berkeley, but it's still undefined code. I've provided a patch. Just what else do I have to do to get you to fix this bug ?
Please send patch to sleepycat.