This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/20689] strict aliasing with temporary variable never gives warnings
- From: "varun0005 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Mar 2005 05:05:57 -0000
- Subject: [Bug c/20689] strict aliasing with temporary variable never gives warnings
- References: <20050330095906.20689.varun0005@gmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From varun0005 at gmail dot com 2005-03-31 05:05 -------
please ignore previous code and consider this piece as example ... problem is
same .the exact programs are following and command line was gcc -Wall -O2
test1.c test2.c....In this why test1.c not giving warning but test2.c giving
violation of strict-aliasing warning.
//test1.c
#include <stdio.h>
#include <stdlib.h>
int main()
{ int *i;
float **q;
int **r;
i =(int *)malloc(sizeof(int));
r=&i;
q=(float **)r;
return 0;
}
//test2.c
int main(){
int *i;
float **q;
i =(int *)malloc(sizeof(int));
q= (float **) &i;
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20689