[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] warning in lrmd.c
From:       Guochun Shi <gshi () ncsa ! uiuc ! edu>
Date:       2005-01-28 10:55:29
Message-ID: 5.1.0.14.2.20050128045239.031ea970 () pop ! ncsa ! uiuc ! edu
[Download RAW message or body]

At 04:49 AM 1/28/2005 -0600, you wrote:
> At 10:46 AM 1/27/2005 +0800, you wrote:
> 
> 
> > Alan Robertson wrote:
> > > Guochun Shi wrote:
> > > 
> > > > with gcc-3.4.3
> > > > 
> > > > [posic067 lrmd]# make if  gcc -DHAVE_CONFIG_H -I. -I. -I../../linux-ha \
> > > >                 -I../../include -I../../include  -I../../include \
> > > >                 -I../../libltdl  
> > > > -I../../libltdl -I../../linux-ha -I../../linux-ha -I../..          
> > > > -I../..  -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   
> > > > -I/usr/include/libxml2  -g -O2  -Wall -Wmissing-prototypes \
> > > > -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wwrite-strings \
> > > > -Wcast-qual -Wcast-align -Wbad-function-cast -Winline \
> > > > -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral \
> > > >                 -Wno-long-long -Werror  -ggdb3 -MT lrmd.o -MD -MP -MF \
> > > >                 ".deps/lrmd.Tpo" \
> > > > -c -o lrmd.o `test -f 'lrmd.c' || echo './'`lrmd.c; \
> > > > then mv -f ".deps/lrmd.Tpo" ".deps/lrmd.Po"; \
> > > > else rm -f ".deps/lrmd.Tpo"; exit 1; \
> > > > fi
> > > > lrmd.c: In function `on_op_done':
> > > > lrmd.c:1469: warning: dereferencing type-punned pointer will break \
> > > >                 strict-aliasing rules
> > > > make: *** [lrmd.o] Error 1
> > > 
> > > Right.
> > > This is because an enum is not an int - and the compiler appears to not like it \
> > > - because it interferes with certain optimizations. According to the C compiler \
> > > info I have, this is supposed to be caused by the -fstrict-aliasing flag.  But, \
> > > we try and turn on no-strict-aliasing, but it looks like we turn it on as \
> > > -Wno-strict-aliasing, instead of -fno-strict-aliasing ...  But, my compiler \
> > > (3.3.4) seems to accept either form.  I wonder if 3.4.3 gets unhappy about \
> > > doing it with -W ?  We will drop the option if -Wno-strict-aliasing results in \
> > > an error when compiling an empty file. 
> > I read the same type warning regarding stonithd.c, think they are harmless and \
> > it's a general way to use casting when using g_hash_table. 
> > It seems -fstrict-aliasing is default in 3.4.3, I guess 3.4.3 gets unhappy with \
> > -Wall, which includes -Wstrict-aliasing and will be triggered by \
> > -fstrict-aliasing. Don't know how to close -fstrict-aliasing, I cannot find the \
> > obvious option such as "-fno-strict-aliasing" regarding gcc 3.3.3. 
> > gshi, can you take a look at your documents regarding gcc 3.4.3 for that? Thanks!
> 
> 
> There is no flag no-strict-aliasing. But weird enough, I found it compiles now. I \
> have no idea how this happens.

I did not find anything about no-strict-aliasing in man gcc or info gcc, but gcc does \
accept either -fno-strict-aliasing  or -Wno-strict-aliasing when I use it to compile \
a simple program.

-Guochun

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic