[Home]

Summary:ASTERISK-10987: Alignment issues building on solaris sparc
Reporter:snuffy (snuffy)Labels:
Date Opened:2007-12-06 16:34:45.000-0600Date Closed:2011-06-07 14:08:19
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Portability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20071228__bug11485.diff.txt
( 1) codec_errors.txt
( 2) dundi_update_bug11485.diff
Description:GCC stops compiling with the following:

warning: cast increases required alignment of target type

Errors for the following files.
chan_sip.c
chan_iax2.c

A lot of codecs

The codec errors seem to stem from the following line:
int16_t *dst = (int16_t *) pvt->outbuf + pvt->samples;

codec_adpcm.c
codec_alaw.c
codec_g722.c
codec_g726.c


****** STEPS TO REPRODUCE ******

  [CC] chan_iax2.c -> chan_iax2.o
chan_iax2.c: In function `send_trunk':
chan_iax2.c:6873: warning: cast increases required alignment of target type
gmake[1]: *** [chan_iax2.o] Error 1
gmake: *** [channels] Error 2

  [CC] chan_sip.c -> chan_sip.o
chan_sip.c: In function `sip_addrcmp':
chan_sip.c:3219: warning: cast increases required alignment of target type
gmake[1]: *** [chan_sip.o] Error 1
gmake: *** [channels] Error 2
Comments:By: snuffy (snuffy) 2007-12-06 16:49:25.000-0600

chan_sip issue is caused by the assignment as noted in code.
char* to a sip_peer*

Codec errors are caused because outbuff is defined as a char* pointer, casting to int16_t breaks alignment.



By: snuffy (snuffy) 2007-12-11 15:40:43.000-0600

Did a little more looking around..
To bypass the errors i cast to (void *) to see how many more remain.

Here is my list (excluding codecs):
chan_sip.c: function sip_addrcmp
char* to a sip_peer*

chan_iax.c: function send_trunk
struct iax2_trunk_peer* to struct iax_frame*

iax-parser.c: function  iax_parse_ies
unsigned char* to sockaddr_in*

More coming

By: Tilghman Lesher (tilghman) 2007-12-28 18:10:16.000-0600

I think the better way to go is to use unions to show the conversion.

By: snuffy (snuffy) 2007-12-29 06:05:56.000-0600

Corydon, I have updated dundi-parser.c to follow what you did with iax-parser.c
Was unsure about the data+3 part..

By: jmls (jmls) 2008-05-03 14:20:56

ping. Housekeeping

By: Leif Madsen (lmadsen) 2008-12-04 15:48:49.000-0600

Closing this issue as it is being dealt with in the related issue. Thanks!