[Bug fortran/71544] gfortran compiler optimization bug when dealing with c-style pointers

noamb at bollweevil dot gdbg.org gcc-bugzilla@gcc.gnu.org
Wed Jun 15 17:41:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71544

--- Comment #4 from noamb <noamb at bollweevil dot gdbg.org> ---
(In reply to noamb from comment #3)

> However, presence of options that are invalid for
> 4.9.3 in that list makes me think that perhaps the correct list of options
> in that (moderately old) version is just different.

The same behavior (incorrect with -O1, correct with full list of specific
options) is also present on linux gfortran 4.9.3 when the list of options
turned on by -O1 is automatically generated by "-O1 -Q --help=optimizers":

tin 1035 : gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gnu/4.9.3/libexec/gcc/x86_64-unknown-linux-gnu/4.9.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/usr/local/gnu/4.9.3
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.9.3 (GCC) 

tin 1036 : gfortran -O1 orig_example.F90 ; ./a.out
 The following line should print 100
   589837704

tin 1037 : gfortran `gfortran -O1 -Q --help=optimizers | grep enabled | awk
'{print $1}'` orig_example.F90 ; ./a.out 
f951: warning: command line option ‘-frtti’ is valid for C++/ObjC++ but not for
Fortran
f951: warning: command line option ‘-fno-threadsafe-statics’ is valid for
C++/ObjC++ but not for Fortran
f951: warning: variable tracking requested, but useless unless producing debug
info
 The following line should print 100
         100


More information about the Gcc-bugs mailing list