Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-08 Thread Harald Dunkel
Andrew Pinski wrote: Wrong, try again. Violating aliasing rules cause undefined behavior so seg faulting is an okay thing to do. But producing a warning message and bad code is not OK. Either using a type-punned pointer should be treated as a fatal error, because gcc would create bad code, or

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-08 Thread Andrew Pinski
On May 8, 2005, at 2:21 AM, Harald Dunkel wrote: Andrew Pinski wrote: Wrong, try again. Violating aliasing rules cause undefined behavior so seg faulting is an okay thing to do. But producing a warning message and bad code is not OK. Either using a type-punned pointer should be treated as a fatal

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-08 Thread Falk Hueffner
Harald Dunkel [EMAIL PROTECTED] writes: Andrew Pinski wrote: Wrong, try again. Violating aliasing rules cause undefined behavior so seg faulting is an okay thing to do. But producing a warning message and bad code is not OK. Either using a type-punned pointer should be treated as a fatal

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-08 Thread Harald Dunkel
Falk Hueffner wrote: It doesn't know that. The warning is for the *creation* of the type-punned pointer, which is still perfectly fine. Gcc is too stupid to notice whether you actually dereference it. Yup. There are billions of this constructs in everbodies and his moms source files. By now

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-08 Thread Andrew Pinski
On May 8, 2005, at 4:17 PM, Harald Dunkel wrote: Falk Hueffner wrote: It doesn't know that. The warning is for the *creation* of the type-punned pointer, which is still perfectly fine. Gcc is too stupid to notice whether you actually dereference it. Yup. There are billions of this constructs in

gcc 4.0.0 on amd64: problem with -O2?

2005-05-07 Thread Harald Dunkel
Hi folks, The attached testcase dies on Debian (amd64) if compiled with -O2. Here is the usual data: % gcc -v Using built-in specs. Target: x86_64-linux Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-07 Thread Andrew Pinski
On May 7, 2005, at 2:04 PM, Harald Dunkel wrote: Hi folks, The testcase has been created by grabbing some code fragments from libX11, XFree86 4.3 on Debian, amd64. -Wall complains about dereferencing type-punned pointer. Stop right there, you said it warns, well this is a case where you are

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-07 Thread Harald Dunkel
Andrew Pinski wrote: Stop right there, you said it warns, well this is a case where you are violating C89/C99/C++ aliasing rules so it is a bug in your code and not in GCC. This is not my code. It is XFree86 4.3. I am just trying to help by investigating a problem and providing an easy

Re: gcc 4.0.0 on amd64: problem with -O2?

2005-05-07 Thread Andrew Pinski
On May 7, 2005, at 3:25 PM, Harald Dunkel wrote: Andrew Pinski wrote: Stop right there, you said it warns, well this is a case where you are violating C89/C99/C++ aliasing rules so it is a bug in your code and not in GCC. This is not my code. It is XFree86 4.3. I am just trying to help by