https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86945
Bug ID: 86945
Summary: BUG with optimisation of select case statement in
gfortran v8.x
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel.price at monash dot edu
Target Milestone: ---
Created attachment 44533
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44533&action=edit
test code to reproduce error
Dear gfortran folks,
Users reported that gfortran-v8.x completely breaks my splash visualisation
tool (http://users.monash.edu.au/~splash). I tracked this down to a bug with
optimisation of the select case statement in gfortran v8.2.0.
Test code with simple example attached. Enter "1" as the input, and output
should be zero (i.e. correct behaviour is to report error code if id is
negative). However, with various levels of optimisation the output I get is as
follows:
$ gfortran-mp-8 -O3 -o test test.f90
$ ./test
enter id
1
ierr = 1
$ gfortran-mp-8 -O1 -o test test.f90
$ ./test
enter id
1
ierr = 1
$ gfortran-mp-8 -o test test.f90
$ ./test
enter id
1
ierr = 0
Please fix this urgently! The outcome for users is that no plotting devices are
opened, because the program incorrectly returns an error code, and therefore
stops execution.
Compiler version as follows:
$ gfortran-mp-8 -v
Using built-in specs.
COLLECT_GCC=gfortran-mp-8
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin17/8.2.0/lto-wrapper
Target: x86_64-apple-darwin17
Configured with:
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc8/gcc8/work/gcc-8.2.0/configure
--prefix=/opt/local --build=x86_64-apple-darwin17
--enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc8
--includedir=/opt/local/include/gcc8 --infodir=/opt/local/share/info
--mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-8
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-8 --with-gxx-include-dir=/opt/local/include/gcc8/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local
--with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto
--enable-libstdcxx-time --with-build-config=bootstrap-debug
--with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--disable-tls --with-pkgversion='MacPorts gcc8 8.2.0_0'
Thread model: posix
gcc version 8.2.0 (MacPorts gcc8 8.2.0_0)