Compile Problem

Igor Sysoev is at rambler-co.ru
Tue Nov 28 14:34:31 MSK 2006


On Tue, 28 Nov 2006, Felix Huber wrote:

> just want to let you know that there seems to be a compile problem with the 
> .14 release
>
> gcc -c -O -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter 
> -Wno-unused-function -Wunused-variable -Wunused-value -Werror -g  -I src/core 
> -I src/event -I src/event/modules -I src/os/unix -I objs \
>               -o objs/src/core/ngx_slab.o \
>               src/core/ngx_slab.c
> cc1: warnings being treated as errors
> src/core/ngx_slab.c: In function ?ngx_slab_alloc?:
> src/core/ngx_slab.c:285: warning: left shift count >= width of type
> src/core/ngx_slab.c:290: warning: left shift count >= width of type
> src/core/ngx_slab.c:372: warning: left shift count >= width of type
> make[1]: *** [objs/src/core/ngx_slab.o] Error 1
> make[1]: Leaving directory `/tmp/nginx-0.4.14'
> make: *** [build] Error 2
>
>
> The older versions run fine (tried Ubuntu and RHEL4)

The patch for 64-bit platforms.


Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/core/ngx_slab.c
===================================================================
--- src/core/ngx_slab.c	(revision 194)
+++ src/core/ngx_slab.c	(working copy)
@@ -149,8 +149,8 @@
 ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size)
 {
     size_t            s;
-    uintptr_t         p, mask, *bitmap;
-    ngx_uint_t        i, n, m, slot, shift, map;
+    uintptr_t         p, n, m, mask, *bitmap;
+    ngx_uint_t        i, slot, shift, map;
     ngx_slab_page_t  *page, *prev, *slots;
 
     ngx_shmtx_lock(&pool->mutex);
@@ -287,7 +287,7 @@
             do {
                 if ((page->slab & NGX_SLAB_MAP_MASK) != mask) {
 
-                    for (m = 1 << NGX_SLAB_MAP_SHIFT, i = 0;
+                    for (m = (uintptr_t) 1 << NGX_SLAB_MAP_SHIFT, i = 0;
                          m & mask;
                          m <<= 1, i++)
                     {
@@ -369,7 +369,7 @@
 
         } else { /* size < ngx_pagesize */
 
-            page->slab = (1 << NGX_SLAB_MAP_SHIFT) | shift;
+            page->slab = ((uintptr_t) 1 << NGX_SLAB_MAP_SHIFT) | shift;
             page->next = &slots[slot];
             page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG;
 


More information about the nginx mailing list