This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: no warning being displayed.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]