[Devel] [ openser-Bugs-1388186 ] Compile failure on AMD64

SourceForge.net noreply at sourceforge.net
Thu Dec 22 18:22:20 CET 2005


Bugs item #1388186, was opened at 2005-12-22 16:45
Message generated for change (Comment added) made by goestelecom
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1388186&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: ver devel
>Status: Open
Resolution: Fixed
Priority: 5
Submitted By: Norman Brandinger (goestelecom)
Assigned to: Bogdan (bogdan_iancu)
Summary: Compile failure on AMD64

Initial Comment:
This problem appears related to the following thread,
at least that is where soem compiler warnings were
first noticed.

http://openser.org/pipermail/devel/2005-November/001122.html

On an AMD64 based machine, the following compile
failure happens:

Compiling items.c
gcc -g -O9 -funroll-loops  -Wcast-align  -Wall 
-minline-all-stringops -falign-loops   -Werror   
-DNAME='"openser"' -DVERSION='"1.1.0-dev4 "'
-DARCH='"x86_64"' -DOS='"freebsd"' -DCOMPILER='"gcc
3.4"' -D__CPU_x86_64 -D__OS_freebsd
-DCFG_DIR='"/usr/local/etc/openser/"' -DPKG_MALLOC
-DSHM_MEM  -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6
-DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES
-DF_MALLOC  -DFAST_LOCK -DADAPTIVE_WAIT
-DADAPTIVE_WAIT_LOOPS=1024  -DHAVE_SOCKADDR_SA_LEN
-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL
-DHAVE_CONNECT_ECONNRESET_BUG -c items.c -o items.o
items.c: In function `xl_get_content_length':
items.c:908: warning: cast from pointer to integer of
different size
gmake: *** [items.o] Error 1


The simple test program below was run on both Intel and
AMD processors

#include <stdio.h>
main() {
  char *ptr;
  printf("Size of int: %d\n", sizeof(int));
  printf("Size of char: %d\n", sizeof(char));
  printf("Size of char*: %d\n", sizeof(ptr));
  printf("Size of long: %d\n", sizeof(long));
  printf("Size of void*: %d\n", sizeof(void*));
  return;
}

AMD64 Results:

Size of int: 4
Size of char: 1
Size of char*: 8
Size of long: 8
Size of void*: 8

Intel Results:

Size of int: 4
Size of char: 1
Size of char*: 4
Size of long: 4
Size of void*: 4

It looks like the difference between the 4 byte int
size and the 8 byte pointer sizes on the AMD based
machines is causing the problem.

Regards,
Norm

p.s. I believe that a couple of other modules (other
than items.c) are effected by this.

----------------------------------------------------------------------

>Comment By: Norman Brandinger (goestelecom)
Date: 2005-12-22 17:22

Message:
Logged In: YES 
user_id=1372252

Changed (int) to (long) on line 908 of item.c -- your
suggestion fixed the problem.

Below is the next error:

gmake[1]: Entering directory
`/usr/local/src/sip-server/modules/acc'
Compiling acc_extra.c
gcc -fPIC -DPIC -g -O9 -funroll-loops  -Wcast-align  -Wall 
-minline-all-stringops -falign-loops   -Werror   
-DNAME='"openser"' -DVERSION='"1.1.0-dev4 "'
-DARCH='"x86_64"' -DOS='"freebsd"' -DCOMPILER='"gcc 3.4"'
-D__CPU_x86_64 -D__OS_freebsd
-DCFG_DIR='"/usr/local/etc/openser/"' -DPKG_MALLOC -DSHM_MEM
 -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP
-DDISABLE_NAGLE -DHAVE_RESOLV_RES -DF_MALLOC  -DFAST_LOCK
-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 
-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2
-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG
-DSQL_ACC -c acc_extra.c -o acc_extra.o
acc_extra.c: In function `parse_acc_extra':
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
acc_extra.c:165: warning: int format, different type arg (arg 4)
gmake[1]: *** [acc_extra.o] Error 1
gmake[1]: Leaving directory
`/usr/local/src/sip-server/modules/acc'


----------------------------------------------------------------------

Comment By: Bogdan (bogdan_iancu)
Date: 2005-12-22 17:07

Message:
Logged In: YES 
user_id=1275325

It's just a warning about improper cast - the parsed pointer
of Content-Length header stores an integer (the length); see
parser/msg_parser.c +171;
When fetching the value, a cast via (long) in required on
64bits machines.

If you found ant other warnings related to this issue,
please report them in order to be fixed.

Thanks

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1388186&group_id=139143



More information about the Devel mailing list