Bug Report - Compile errors in vacuum.c and shmem.c
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Billy G. Allie
Your email address : Bill.Allie@mug.org
System Configuration
---------------------
Architecture (example: Intel Pentium) : Pentium
Operating System (example: Linux 2.0.26 ELF) : UnixWare 7.0.1
PostgreSQL version (example: PostgreSQL-6.4) : Current CVS version
Compiler used (example: gcc 2.8.0) : Optimizing C Compilation
System (CCS) 3.2 08/18/98
(u701)
Please enter a FULL description of your problem:
------------------------------------------------
Compiling 'vacuum.c' produces the following errors:
UX:acomp: ERROR: "vacuum.c", line 2424: cannot do pointer arithmetic on
operand of unknown size
UX:acomp: ERROR: "vacuum.c", line 2428: cannot do pointer arithmetic on
operand of unknown size
UX:acomp: ERROR: "vacuum.c", line 2431: cannot do pointer arithmetic on
operand of unknown size
UX:acomp: ERROR: "vacuum.c", line 2433: cannot do pointer arithmetic on
operand of unknown size
UX:acomp: ERROR: "vacuum.c", line 2448: cannot do pointer arithmetic on
operand of unknown size
Compiling 'shmem.c' produces the following error:
UX:acomp: ERROR: "shmem.c", line 740: void function cannot return value
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
Compile the program on a strict ANSI C compiler :-)
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
The attached patch will fix the problems.
In vacuumc.c, pointer arithmatic was performed on a pointer of type void. The
patch casts the void pointer to a character pointer, does the arithmatic, and
then casts the result back to a void pointer.
In shmem.c, a function of type void returned a value. The patch removes the
offending return statement.
Attachments:
uw7.19990330.patchapplication/x-patch; name=uw7.19990330.patchDownload
*** src/backend/commands/vacuum.c.orig Wed Mar 31 01:57:35 1999
--- src/backend/commands/vacuum.c Wed Mar 31 02:00:05 1999
***************
*** 2421,2436 ****
}
if (last_move == true)
{
! res = compar(elm, bot + last * size);
if (res > 0)
return NULL;
if (res == 0)
! return bot + last * size;
last_move = false;
}
! res = compar(elm, bot + celm * size);
if (res == 0)
! return bot + celm * size;
if (res < 0)
{
if (celm == 0)
--- 2421,2436 ----
}
if (last_move == true)
{
! res = compar(elm, (void *)((char *)bot + last * size));
if (res > 0)
return NULL;
if (res == 0)
! return (void *)((char *)bot + last * size);
last_move = false;
}
! res = compar(elm, (void *)((char *)bot + celm * size));
if (res == 0)
! return (void *)((char *)bot + celm * size);
if (res < 0)
{
if (celm == 0)
***************
*** 2445,2451 ****
return NULL;
last = last - celm - 1;
! bot = bot + (celm + 1) * size;
celm = (last + 1) / 2;
first_move = true;
}
--- 2445,2451 ----
return NULL;
last = last - celm - 1;
! bot = (void *)((char *)bot + (celm + 1) * size);
celm = (last + 1) / 2;
first_move = true;
}
*** src/backend/storage/ipc/shmem.c.orig Wed Mar 31 02:20:06 1999
--- src/backend/storage/ipc/shmem.c Wed Mar 31 02:20:28 1999
***************
*** 737,741 ****
SpinRelease(ShmemIndexLock);
elog(ERROR, "GetXmaxRecent: ShmemIndex corrupted");
- return NULL;
}
--- 737,740 ----