List Info

Thread: Compiler warnings using gcc-4.1




Compiler warnings using gcc-4.1
user name
2006-12-19 21:30:15
Hi Josh et al,

I'm compiling on an Ubuntu Edgy x86 machine. Edgy comes
standard
with gcc-4.1 and I'm getting a number of warnings:

   memory.c: In function 'FLAC__memory_alloc_aligned':
   memory.c:52: warning: cast from pointer to integer of
different size
   memory.c:52: warning: cast to pointer from integer of
different size

   metadata_iterators.c: In function
'read_metadata_block_data_picture_cb_':
   metadata_iterators.c:2370: warning: dereferencing
type-punned pointer will 
   break strict-aliasing rules

   metadata_object.c: In function
'FLAC__metadata_object_new':
   metadata_object.c:504: warning: dereferencing type-punned
pointer will break 
   strict-aliasing rules
   metadata_object.c: In function
'FLAC__metadata_object_clone':
   metadata_object.c:548: warning: dereferencing type-punned
pointer will break 
   strict-aliasing rules
   metadata_object.c:596: warning: dereferencing type-punned
pointer will break 
   strict-aliasing rules
   metadata_object.c: In function
'FLAC__metadata_object_picture_set_mime_type':
   metadata_object.c:1710: warning: dereferencing
type-punned pointer will break 
   strict-aliasing rules

   encode.c:2710: warning: 'limit_channel_mask' defined but
not used

    http.c:433: warning: pointer targets in passing argument
5 of 'getsockopt' 
    differ in signedness

Are you interested in fixing these? The first and the last
are pretty
easy to fix, but I know from my own code that the
"dereferencing type-punned
pointer" warnings require more intrusive work to fix
them.

Cheers,
Erik
-- 
+-----------------------------------------------------------
+
  Erik de Castro Lopo
+-----------------------------------------------------------
+
"Christianity has a nasty habit of ignoring the major
problems of
our time, including overpopulation and exhaustion of
resources, 
because  they aren't mentioned in the Bible."
-- Paula L. Craig
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
Compiler warnings using gcc-4.1
user name
2007-01-02 21:27:29
--- Erik de Castro Lopo <erikd-flacmega-nerd.com> wrote:
> Hi Josh et al,
> 
> I'm compiling on an Ubuntu Edgy x86 machine. Edgy comes
standard
> with gcc-4.1 and I'm getting a number of warnings:
> 
>    memory.c: In function 'FLAC__memory_alloc_aligned':
>    memory.c:52: warning: cast from pointer to integer
of different
> size
>    memory.c:52: warning: cast to pointer from integer
of different
> size
> 
>    metadata_iterators.c: In function
> 'read_metadata_block_data_picture_cb_':
>    metadata_iterators.c:2370: warning: dereferencing
type-punned
> pointer will 
>    break strict-aliasing rules
> 
>    metadata_object.c: In function
'FLAC__metadata_object_new':
>    metadata_object.c:504: warning: dereferencing
type-punned pointer
> will break 
>    strict-aliasing rules
>    metadata_object.c: In function
'FLAC__metadata_object_clone':
>    metadata_object.c:548: warning: dereferencing
type-punned pointer
> will break 
>    strict-aliasing rules
>    metadata_object.c:596: warning: dereferencing
type-punned pointer
> will break 
>    strict-aliasing rules
>    metadata_object.c: In function
> 'FLAC__metadata_object_picture_set_mime_type':
>    metadata_object.c:1710: warning: dereferencing
type-punned pointer
> will break 
>    strict-aliasing rules
> 
>    encode.c:2710: warning: 'limit_channel_mask' defined
but not used
> 
>     http.c:433: warning: pointer targets in passing
argument 5 of
> 'getsockopt' 
>     differ in signedness
> 
> Are you interested in fixing these? The first and the
last are pretty
> easy to fix, but I know from my own code that the
"dereferencing
> type-punned pointer" warnings require more
intrusive work to fix
them.

yes, I definitely want to fix them all.  the ones from
memory.c
are actually "on purpose", but if you know of a
more correct and
warning-less way to align pointers that will work for
different
pointer widths (I'm sure there must be one) please let me
know.

Josh


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around 
http://mail.yahoo.com 
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
Compiler warnings using gcc-4.1
user name
2007-01-02 21:53:17
Josh Coalson wrote:

> yes, I definitely want to fix them all.  the ones from
memory.c
> are actually "on purpose", but if you know of
a more correct and
> warning-less way to align pointers that will work for
different
> pointer widths (I'm sure there must be one) please let
me know.

Well for the aligned pointer allocation you can use
posix_memalign
which from the Linux man page looks like:

       #define _XOPEN_SOURCE 600
       #include <stdlib.h>

       int posix_memalign(void **memptr, size_t alignment,
size_t size);

    DESCRIPTION
       The function posix_memalign() allocates size bytes
and places 
       the address of the allocated memory in *memptr.  The
address of 
       the allocated memory will be a multiple  of 
alignment, which 
       must be a power of two and a multiple of sizeof(void
*).

Cheers,
Erik
-- 
+-----------------------------------------------------------
+
  Erik de Castro Lopo
+-----------------------------------------------------------
+
Being really good at C++ is like being really good at using
rocks to
sharpen sticks." -- Thant Tessman
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )