[Bug tree-optimization/36226] New: Optimization corrupts volatile function pointer return handling

2008-05-12 Thread mbenedict at aclaratech dot com
When using a volatile function pointer and compiling with -O2 optimization, the
resulting program will not correctly return from the function pointer but will
instead jump to another point of the program.  I have been able to reproduce
this behavior with gcc 3.4.6, 4.0.2 and the x86 locally hosted 4.1.1 version of
gcc.

Originally the bug was discovered with:
$ powerpc-603-linux-gnu-gcc -v
Reading specs from
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu/lib/gcc/powerpc-603-linux-gnu/3.4.5/specs
Configured with:
/home/mbenedict/src/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure
--target=powerpc-603-linux-gnu --host=i686-host_pc-linux-gnu
--prefix=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu
--with-cpu=603 --enable-cxx-flags=-mcpu=603
--with-headers=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu/include
--with-local-prefix=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.5

I will attach the .i file that reproduces this condition in the first comment
(I can't seem to attach from the new bug screen).


-- 
   Summary: Optimization corrupts volatile function pointer return
handling
   Product: gcc
   Version: 3.4.5
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mbenedict at aclaratech dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: powerpc-603-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36226



[Bug tree-optimization/36226] Optimization corrupts volatile function pointer return handling

2008-05-12 Thread mbenedict at aclaratech dot com


--- Comment #1 from mbenedict at aclaratech dot com  2008-05-12 22:48 
---
Created an attachment (id=15632)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15632&action=view)
File that reproduces the problem

Note also that when optimizing (-O2) the assembly comment" # XXX - This
assembly line is missing when optimized" goes away


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36226