This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: no warning being displayed.
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Inder <inderpreetb at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 7 Nov 2005 10:50:18 +0100
- Subject: Re: no warning being displayed.
- References: <a1029acd0511062211i27502e84p29d51561ca52ab26@mail.gmail.com> <a1029acd0511062214q1dbcb727xb16c3f3040d5de33@mail.gmail.com>
On 11/7/05, Inder <inderpreetb@gmail.com> wrote:
> Hi all,
> I am compiling small program on a SPARC gcc 3.4.3
>
> test.c
> -------------------------------------------------------
>
>
> int main()
> {
> struct test1* t1, t11;
> struct test2* t2 ;
> struct test3* t3;
>
> t1 = &t11;
> t2 = (struct t2*)t1;
> t3 = (struct t3*)t1;
these should indeed give a warning, as you introduce a new structure
t2/t3 here. You want to use struct test2* and struct test3* here. If we
don't get a warning here for older compilers it may be due to some weird
interaction in the warning machinery that is confused by the decl for t2/t3.
But this surely isn't going to be fixed in older compilers.
Richard.