- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm running into a difference in the behavior between using ifx -g and ifort -g.
The old code works as expected with ifx when the -g flag is not used but throws an integer divide by zero when the -g flag is used.
With ifort the code works as expected with and without the -g flag.
Moving a legacy application to a new a OS and the -g flag is a lifesaver.
The problem showed up with this statement.
DO WHILE ((B .NE. 0) .AND. (MOD(A,B) .GT. 0))
I have added an IF statement in the test case that exhibits the behavior.
Thanks in advance for any insights/help.
Rich
PROGRAM TEST_GCD
INTEGER*4 A
INTEGER*4 B
INTEGER*4 HUNT_CHK
A = 360
B = 0
IF ((B .NE. 0) .AND. (MOD(A,B) .GT. 0)) THEN
HUNT_CHK = HUNT_GCD(A,B)
ELSE
WRITE(*,10)'Avoided divide by zero'
10 FORMAT(A)
END IF
END
INTEGER*4 FUNCTION HUNT_GCD(A,B)
INTEGER*4 A
INTEGER*4 B
INTEGER*4 R
DO WHILE ((B .NE. 0) .AND. (MOD(A,B) .GT. 0))
R = MOD(A,B)
A = B
B = R
END DO
HUNT_GCD = B
RETURN
END
test/test_gcd> ifx test_gcd.for;./a.out
Avoided divide by zero
test/test_gcd> rm a.out;ifx -g test_gcd.for;./a.out
ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
forrtl: severe (71): integer divide by zero
Image PC Routine Line Source
libpthread-2.31.s 00007F7F91975910 Unknown Unknown Unknown
a.out 0000000000404288 Unknown Unknown Unknown
a.out 000000000040423D Unknown Unknown Unknown
libc-2.31.so 00007F7F9179D24D __libc_start_main Unknown Unknown
a.out 000000000040416A Unknown Unknown Unknown
test/test_gcd> rm a.out;ifort test_gcd.for;./a.out
Avoided divide by zero
test/test_gcd> rm a.out;ifort -g test_gcd.for;./a.out
Avoided divide by zero
test/test_gcd> ifx --version
ifx (IFX) 2023.1.0 20230320
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
test/test_gcd> ifort --version
ifort (IFORT) 2021.9.0 20230302
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
test/test_gcd> uname -a
Linux 5.14.21-150500.55.19-default #1 SMP PREEMPT_DYNAMIC Tue Aug 8 22:15:01 UTC 2023 (9908c29) x86_64 x86_64 x86_64 GNU/Linux
test/test_gcd> more /etc/os-release
NAME="openSUSE Leap"
VERSION="15.5"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.5"
PRETTY_NAME="openSUSE Leap 15.5"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.5"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"
test/test_gcd> rm a.out;ifx -g -watch=all test_gcd.for;./a.out
ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
echo test_gcd.for
test_gcd.for
/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/xfortcom \
-triple \
x86_64-unknown-linux-gnu \
-emit-obj \
-mrelax-all \
"-verify nomodule" \
-main-file-name \
test_gcd.for \
-mllvm \
--relocation-model=static \
"-options-string -g -watch=all " \
-mframe-pointer=all \
-omp_simd \
-target-cpu \
x86-64 \
-target-linker-version \
2.39.0.20220810 \
-debug-info-kind=limited \
-dwarf-version=4 \
-mllvm \
-debug-line-version=2 \
-fveclib=SVML \
-fno-inline \
-fno-inline-functions \
-mllvm \
-loopopt=1 \
-floopopt-pipeline=light \
-mllvm \
-disable-hir-generate-mkl-call \
-mllvm \
-paropt=11 \
-mllvm \
-vecopt=true \
-mllvm \
-enable-vec-clone=true \
-fintel-libirc-allowed \
-o \
/tmp/ifx1680834573gr8BAU/ifxFK46BY.o \
-D__INTEL_LLVM_COMPILER=20230100 \
-D__INTEL_LLVM_COMPILER_UPDATE=0 \
-D__unix__ \
-D__unix \
-D__linux__ \
-D__linux \
-D__gnu_linux__ \
-Dunix \
-Dlinux \
-D__ELF__ \
-D__x86_64 \
-D__x86_64__ \
-D__amd64 \
-D__amd64__ \
-D__INTEL_COMPILER_BUILD_DATE=20230320 \
-D__INTEL_COMPILER=20230100 \
-D__INTEL_COMPILER_UPDATE=0 \
-I. \
-I/opt/intel/oneapi/tbb/2021.9.0/env/../include \
-I/opt/intel/oneapi/mpi/2021.9.0//include \
-I/opt/intel/oneapi/mkl/2023.1.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/ippcp/2021.7.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/dpl/2022.1.0/linux/include \
-I/opt/intel/oneapi/dpcpp-ct/2023.1.0/include \
-I/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/include \
-I/opt/intel/oneapi/dev-utilities/2021.9.0/include \
-I/opt/intel/oneapi/dal/2023.1.0/include \
-I/opt/intel/oneapi/ccl/2021.9.0/include/cpu_gpu_dpcpp \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/include/intel64 \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/include \
-I/usr/local/include \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16/include \
-I/usr/include \
"-fp_modbits honor_f32_conversion" \
"-fp_modbits honor_f64_conversion" \
-omp_simd \
-O0 \
-g2 \
"-reentrancy threaded" \
-simd \
-offload_host \
test_gcd.for
ld \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crt1.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crti.o \
/usr/lib64/gcc/x86_64-suse-linux/7/crtbegin.o \
--eh-frame-hdr \
--build-id \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-m \
elf_x86_64 \
-o \
a.out \
/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/for_main.o \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8 \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release \
-L/opt/intel/oneapi/mpi/2021.9.0//lib \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64 \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16/lib/linux \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/usr/lib64/gcc/x86_64-suse-linux/7/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64 \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/ \
-L/lib/../lib64 \
-L/lib/../lib64/ \
-L/usr/lib/../lib64 \
-L/usr/lib/../lib64/ \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8/ \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/ \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64/ \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64/ \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib/ \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/ \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64/ \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../ \
-L/lib64 \
-L/lib/ \
-L/usr/lib64 \
-L/usr/lib \
/tmp/ifx1680834573gr8BAU/ifxFK46BY.o \
-Bdynamic \
-Bstatic \
-lifport \
-lifcoremt \
-Bdynamic \
-limf \
-Bstatic \
-lsvml \
-Bdynamic \
-lm \
-Bstatic \
-lipgo \
-lirc \
-Bdynamic \
-lpthread \
-Bstatic \
-lsvml \
-Bdynamic \
-lc \
-lgcc \
-lgcc_s \
-Bstatic \
-lirc_s \
-Bdynamic \
-ldl \
-lc \
/usr/lib64/gcc/x86_64-suse-linux/7/crtend.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crtn.o
rm /tmp/ifx1680834573gr8BAU/ifxdashvRApXpY
rm /tmp/ifx1680834573gr8BAU/ifxdummy7incvX.c
rm /tmp/ifx1680834573gr8BAU/ifxclangdashvGqbwCY
rm /tmp/ifx1680834573gr8BAU/ifxsearchdirsqJAgAX
rm /tmp/ifx1680834573gr8BAU/ifxgccdashvgxPv8V
rm /tmp/ifx1680834573gr8BAU/ifxFK46BY.o
rm /tmp/ifx1680834573gr8BAU/ifxldashvMBDXtV
rm /tmp/ifx1680834573gr8BAU/ifxargu2NqwV
rm /tmp/ifx1680834573gr8BAU/ifxFK46BY.o
forrtl: severe (71): integer divide by zero
Image PC Routine Line Source
libpthread-2.31.s 00007F6384A94910 Unknown Unknown Unknown
a.out 0000000000404288 Unknown Unknown Unknown
a.out 000000000040423D Unknown Unknown Unknown
libc-2.31.so 00007F63848BC24D __libc_start_main Unknown Unknown
a.out 000000000040416A Unknown Unknown Unknown
test/test_gcd> rm a.out;ifx -watch=all test_gcd.for;./a.out
echo test_gcd.for
test_gcd.for
/opt/intel/oneapi/compiler/2023.1.0/linux/bin-llvm/xfortcom \
-triple \
x86_64-unknown-linux-gnu \
-emit-obj \
"-verify nomodule" \
-main-file-name \
test_gcd.for \
-mllvm \
--relocation-model=static \
"-options-string -watch=all " \
-mframe-pointer=none \
-omp_simd \
-target-cpu \
x86-64 \
-target-linker-version \
2.39.0.20220810 \
-fveclib=SVML \
-mllvm \
-loopopt=1 \
-floopopt-pipeline=light \
-mllvm \
-disable-hir-generate-mkl-call \
-mllvm \
-paropt=11 \
-fintel-libirc-allowed \
-o \
/tmp/ifx0932856898N6C9rI/ifx894jjJ.o \
-D__INTEL_LLVM_COMPILER=20230100 \
-D__INTEL_LLVM_COMPILER_UPDATE=0 \
-D__unix__ \
-D__unix \
-D__linux__ \
-D__linux \
-D__gnu_linux__ \
-Dunix \
-Dlinux \
-D__ELF__ \
-D__x86_64 \
-D__x86_64__ \
-D__amd64 \
-D__amd64__ \
-D__INTEL_COMPILER_BUILD_DATE=20230320 \
-D__INTEL_COMPILER=20230100 \
-D__INTEL_COMPILER_UPDATE=0 \
-I. \
-I/opt/intel/oneapi/tbb/2021.9.0/env/../include \
-I/opt/intel/oneapi/mpi/2021.9.0//include \
-I/opt/intel/oneapi/mkl/2023.1.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/ippcp/2021.7.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/dpl/2022.1.0/linux/include \
-I/opt/intel/oneapi/dpcpp-ct/2023.1.0/include \
-I/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/include \
-I/opt/intel/oneapi/dev-utilities/2021.9.0/include \
-I/opt/intel/oneapi/dal/2023.1.0/include \
-I/opt/intel/oneapi/ccl/2021.9.0/include/cpu_gpu_dpcpp \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/include/intel64 \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/include \
-I/usr/local/include \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16/include \
-I/usr/include \
-omp_simd \
-O2 \
"-reentrancy threaded" \
"-unroll 2" \
-simd \
-offload_host \
test_gcd.for
ld \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crt1.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crti.o \
/usr/lib64/gcc/x86_64-suse-linux/7/crtbegin.o \
--eh-frame-hdr \
--build-id \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-m \
elf_x86_64 \
-o \
a.out \
/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/for_main.o \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8 \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release \
-L/opt/intel/oneapi/mpi/2021.9.0//lib \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64 \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16/lib/linux \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/usr/lib64/gcc/x86_64-suse-linux/7/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64 \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/ \
-L/lib/../lib64 \
-L/lib/../lib64/ \
-L/usr/lib/../lib64 \
-L/usr/lib/../lib64/ \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8/ \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/ \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64/ \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64/ \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib/ \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/ \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64/ \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../ \
-L/lib64 \
-L/lib/ \
-L/usr/lib64 \
-L/usr/lib \
/tmp/ifx0932856898N6C9rI/ifx894jjJ.o \
-Bdynamic \
-Bstatic \
-lifport \
-lifcoremt \
-Bdynamic \
-limf \
-Bstatic \
-lsvml \
-Bdynamic \
-lm \
-Bstatic \
-lipgo \
-lirc \
-Bdynamic \
-lpthread \
-Bstatic \
-lsvml \
-Bdynamic \
-lc \
-lgcc \
-lgcc_s \
-Bstatic \
-lirc_s \
-Bdynamic \
-ldl \
-lc \
/usr/lib64/gcc/x86_64-suse-linux/7/crtend.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crtn.o
rm /tmp/ifx0932856898N6C9rI/ifxdashvxgnvwF
rm /tmp/ifx0932856898N6C9rI/ifxdummyIEbMjH.c
rm /tmp/ifx0932856898N6C9rI/ifxclangdashvWrviaI
rm /tmp/ifx0932856898N6C9rI/ifxsearchdirsUXxtZF
rm /tmp/ifx0932856898N6C9rI/ifxgccdashv0rwd1G
rm /tmp/ifx0932856898N6C9rI/ifx894jjJ.o
rm /tmp/ifx0932856898N6C9rI/ifxldashvDlrdzJ
rm /tmp/ifx0932856898N6C9rI/ifxarg2oih1I
rm /tmp/ifx0932856898N6C9rI/ifx894jjJ.o
Avoided divide by zero
test/test_gcd> rm a.out;ifort -watch=all test_gcd.for;./a.out
echo test_gcd.for
test_gcd.for
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/fortcom \
-D__INTEL_COMPILER=2021 \
-D__INTEL_COMPILER_UPDATE=9 \
-D__unix__ \
-D__unix \
-D__linux__ \
-D__linux \
-D__gnu_linux__ \
-Dunix \
-Dlinux \
-D__ELF__ \
-D__x86_64 \
-D__x86_64__ \
-D__amd64 \
-D__amd64__ \
-D__INTEL_COMPILER_BUILD_DATE=20230302 \
-D__INTEL_OFFLOAD \
-D__MMX__ \
-D__SSE__ \
-D__SSE_MATH__ \
-D__SSE2__ \
-D__SSE2_MATH__ \
-D__pentium4 \
-D__pentium4__ \
-D__tune_pentium4__ \
-I. \
-I/opt/intel/oneapi/tbb/2021.9.0/env/../include \
-I/opt/intel/oneapi/mpi/2021.9.0//include \
-I/opt/intel/oneapi/mkl/2023.1.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/ippcp/2021.7.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/dpl/2022.1.0/linux/include \
-I/opt/intel/oneapi/dpcpp-ct/2023.1.0/include \
-I/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/include \
-I/opt/intel/oneapi/dev-utilities/2021.9.0/include \
-I/opt/intel/oneapi/dal/2023.1.0/include \
-I/opt/intel/oneapi/ccl/2021.9.0/include/cpu_gpu_dpcpp \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include/intel64 \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include/icc \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include \
-I/usr/local/include \
-I/usr/lib64/gcc/x86_64-suse-linux/7/include \
-I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed \
-I/usr/include/ \
-I/usr/include \
-omp_simd \
-O2 \
"-reentrancy threaded" \
-simd \
-offload_host \
-mGLOB_em64t=TRUE \
-mP1OPT_version=2021.9.0-intel64 \
-mGLOB_diag_file=/tmp/iforttYlj0w.diag \
-mGLOB_long_size_64 \
-mGLOB_routine_pointer_size_64 \
-mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 \
-mP2OPT_static_promotion \
-mGLOB_pack_sort_init_list \
-mP1OPT_print_version=FALSE \
-mCG_use_gas_got_workaround=F \
-mP2OPT_align_option_used=TRUE \
-mGLOB_gcc_version=750 \
-mGLOB_options_string=-watch=all \
-mGLOB_cxx_limited_range=FALSE \
-mCG_extend_parms=FALSE \
-mGLOB_compiler_bin_directory=/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64 \
-mGLOB_as_output_backup_file_name=/tmp/ifortqY3gvvas_.s \
-mGLOB_dashboard_use_source_name \
-mIPOPT_activate \
-mIPOPT_lite \
-mGLOB_uarch_tuning=0x0 \
-mGLOB_product_id_code=0x22006d91 \
-mCG_bnl_movbe=T \
-mP3OPT_use_mspp_call_convention \
-mP2OPT_subs_out_of_bound=FALSE \
-mP2OPT_disam_type_based_disam=2 \
-mGLOB_ansi_alias \
-mPGOPTI_value_profile_use=T \
-mGLOB_opt_report_use_source_name \
-mGLOB_offload_mode=1 \
-mGLOB_offload_no_openmp=TRUE \
-mP2OPT_offload_unique_var_string=ifort04358178056VGqJx \
-mP2OPT_hlo_level=2 \
-mP2OPT_hlo \
-mP2OPT_hpo_rtt_control=0 \
-mIPOPT_args_in_regs=0 \
-mP2OPT_disam_assume_nonstd_intent_in=FALSE \
-mGLOB_imf_mapping_library=/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/libiml_attr.so \
-mIPOPT_single_file_compile_and_link=TRUE \
-mPGOPTI_gen_threadsafe_level=0 \
-mIPOPT_lto_object_enabled \
-mIPOPT_lto_object_value=1 \
-mIPOPT_obj_output_file_name=/tmp/iforttYlj0w.o \
-mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarchElUgdx \
-mGLOB_linker_version=2.39.0.20220810 \
-mGLOB_linker=ld \
-mGLOB_driver_tempfile_name=/tmp/iforttempfilegIQyQw \
-mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS \
-mGLOB_async_unwind_tables=TRUE \
-mGLOB_obj_output_file=/tmp/iforttYlj0w.o \
-mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN \
-mP1OPT_source_file_name=test_gcd.for \
-mP1OPT_full_source_file_name=/NFS_EXPORTS/SOURCE/test/test_gcd/test_gcd.for \
-mP2OPT_symtab_type_copy=true \
test_gcd.for
ld \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crt1.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crti.o \
/usr/lib64/gcc/x86_64-suse-linux/7/crtbegin.o \
--eh-frame-hdr \
--build-id \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-m \
elf_x86_64 \
-plugin \
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/../../lib/icx-lto.so \
-o \
a.out \
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin/for_main.o \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8 \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release \
-L/opt/intel/oneapi/mpi/2021.9.0//lib \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64 \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin \
-L/usr/lib64/gcc/x86_64-suse-linux/7/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64 \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/ \
-L/lib/../lib64 \
-L/lib/../lib64/ \
-L/usr/lib/../lib64 \
-L/usr/lib/../lib64/ \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8/ \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/ \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64/ \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64/ \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib/ \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/ \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64/ \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../ \
-L/lib64 \
-L/lib/ \
-L/usr/lib64 \
-L/usr/lib \
/tmp/iforttYlj0w.o \
-Bdynamic \
-Bstatic \
-lifport \
-lifcoremt \
-limf \
-lsvml \
-Bdynamic \
-lm \
-Bstatic \
-lipgo \
-lirc \
-Bdynamic \
-lpthread \
-Bstatic \
-lsvml \
-Bdynamic \
-lc \
-lgcc \
-lgcc_s \
-Bstatic \
-lirc_s \
-Bdynamic \
-ldl \
-lc \
/usr/lib64/gcc/x86_64-suse-linux/7/crtend.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crtn.o
rm /tmp/ifortdashvaMw0Az
rm /tmp/ifortdummypGUzvx.c
rm /tmp/ifortsearchdirsYTh2ly
rm /tmp/ifortgccdashvU8liUv
rm /tmp/iforttYlj0w.o
rm /tmp/ifortqY3gvvas_.s
rm /tmp/ifortldashvJ2PPVw
rm /tmp/iforttempfilegIQyQw
rm /tmp/ifortargLqFUtw
rm /tmp/iforttYlj0w.o
Avoided divide by zero
test/test_gcd> rm a.out;ifort -watch=all test_gcd.for;./a.out
echo test_gcd.for
test_gcd.for
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/fortcom \
-D__INTEL_COMPILER=2021 \
-D__INTEL_COMPILER_UPDATE=9 \
-D__unix__ \
-D__unix \
-D__linux__ \
-D__linux \
-D__gnu_linux__ \
-Dunix \
-Dlinux \
-D__ELF__ \
-D__x86_64 \
-D__x86_64__ \
-D__amd64 \
-D__amd64__ \
-D__INTEL_COMPILER_BUILD_DATE=20230302 \
-D__INTEL_OFFLOAD \
-D__MMX__ \
-D__SSE__ \
-D__SSE_MATH__ \
-D__SSE2__ \
-D__SSE2_MATH__ \
-D__pentium4 \
-D__pentium4__ \
-D__tune_pentium4__ \
-I. \
-I/opt/intel/oneapi/tbb/2021.9.0/env/../include \
-I/opt/intel/oneapi/mpi/2021.9.0//include \
-I/opt/intel/oneapi/mkl/2023.1.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/ippcp/2021.7.0/include \
-I/opt/intel/oneapi/ipp/2021.8.0/include \
-I/opt/intel/oneapi/dpl/2022.1.0/linux/include \
-I/opt/intel/oneapi/dpcpp-ct/2023.1.0/include \
-I/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/include \
-I/opt/intel/oneapi/dev-utilities/2021.9.0/include \
-I/opt/intel/oneapi/dal/2023.1.0/include \
-I/opt/intel/oneapi/ccl/2021.9.0/include/cpu_gpu_dpcpp \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include/intel64 \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include/icc \
-I/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/include \
-I/usr/local/include \
-I/usr/lib64/gcc/x86_64-suse-linux/7/include \
-I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed \
-I/usr/include/ \
-I/usr/include \
-omp_simd \
-O2 \
"-reentrancy threaded" \
-simd \
-offload_host \
-mGLOB_em64t=TRUE \
-mP1OPT_version=2021.9.0-intel64 \
-mGLOB_diag_file=/tmp/ifort40QEgi.diag \
-mGLOB_long_size_64 \
-mGLOB_routine_pointer_size_64 \
-mGLOB_source_language=GLOB_SOURCE_LANGUAGE_F90 \
-mP2OPT_static_promotion \
-mGLOB_pack_sort_init_list \
-mP1OPT_print_version=FALSE \
-mCG_use_gas_got_workaround=F \
-mP2OPT_align_option_used=TRUE \
-mGLOB_gcc_version=750 \
-mGLOB_options_string=-watch=all \
-mGLOB_cxx_limited_range=FALSE \
-mCG_extend_parms=FALSE \
-mGLOB_compiler_bin_directory=/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64 \
-mGLOB_as_output_backup_file_name=/tmp/ifortgdctnias_.s \
-mGLOB_dashboard_use_source_name \
-mIPOPT_activate \
-mIPOPT_lite \
-mGLOB_uarch_tuning=0x0 \
-mGLOB_product_id_code=0x22006d91 \
-mCG_bnl_movbe=T \
-mP3OPT_use_mspp_call_convention \
-mP2OPT_subs_out_of_bound=FALSE \
-mP2OPT_disam_type_based_disam=2 \
-mGLOB_ansi_alias \
-mPGOPTI_value_profile_use=T \
-mGLOB_opt_report_use_source_name \
-mGLOB_offload_mode=1 \
-mGLOB_offload_no_openmp=TRUE \
-mP2OPT_offload_unique_var_string=ifort0819183567OYW9qk \
-mP2OPT_hlo_level=2 \
-mP2OPT_hlo \
-mP2OPT_hpo_rtt_control=0 \
-mIPOPT_args_in_regs=0 \
-mP2OPT_disam_assume_nonstd_intent_in=FALSE \
-mGLOB_imf_mapping_library=/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/libiml_attr.so \
-mIPOPT_single_file_compile_and_link=TRUE \
-mPGOPTI_gen_threadsafe_level=0 \
-mIPOPT_lto_object_enabled \
-mIPOPT_lto_object_value=1 \
-mIPOPT_obj_output_file_name=/tmp/ifort40QEgi.o \
-mIPOPT_whole_archive_fixup_file_name=/tmp/ifortwarchvg5cmi \
-mGLOB_linker_version=2.39.0.20220810 \
-mGLOB_linker=ld \
-mGLOB_driver_tempfile_name=/tmp/iforttempfileaVdbph \
-mP3OPT_asm_target=P3OPT_ASM_TARGET_GAS \
-mGLOB_async_unwind_tables=TRUE \
-mGLOB_obj_output_file=/tmp/ifort40QEgi.o \
-mGLOB_source_dialect=GLOB_SOURCE_DIALECT_FORTRAN \
-mP1OPT_source_file_name=test_gcd.for \
-mP1OPT_full_source_file_name=/NFS_EXPORTS/SOURCE/test/test_gcd/test_gcd.for \
-mP2OPT_symtab_type_copy=true \
test_gcd.for
ld \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crt1.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crti.o \
/usr/lib64/gcc/x86_64-suse-linux/7/crtbegin.o \
--eh-frame-hdr \
--build-id \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-m \
elf_x86_64 \
-plugin \
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../bin/intel64/../../lib/icx-lto.so \
-o \
a.out \
/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin/for_main.o \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8 \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release \
-L/opt/intel/oneapi/mpi/2021.9.0//lib \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64 \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64 \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64 \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64 \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/../../compiler/lib/intel64_lin \
-L/usr/lib64/gcc/x86_64-suse-linux/7/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64 \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/ \
-L/lib/../lib64 \
-L/lib/../lib64/ \
-L/usr/lib/../lib64 \
-L/usr/lib/../lib64/ \
-L/opt/intel/oneapi/tbb/2021.9.0/env/../lib/intel64/gcc4.8/ \
-L/opt/intel/oneapi/mpi/2021.9.0//libfabric/lib/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/release/ \
-L/opt/intel/oneapi/mpi/2021.9.0//lib/ \
-L/opt/intel/oneapi/mkl/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/ipp/2021.8.0/lib/intel64/ \
-L/opt/intel/oneapi/ippcp/2021.7.0/lib/intel64/ \
-L/opt/intel/oneapi/dnnl/2023.1.0/cpu_dpcpp_gpu_dpcpp/lib/ \
-L/opt/intel/oneapi/dal/2023.1.0/lib/intel64/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/compiler/lib/intel64_lin/ \
-L/opt/intel/oneapi/compiler/2023.1.0/linux/lib/ \
-L/opt/intel/oneapi/clck/2021.7.3/lib/intel64/ \
-L/opt/intel/oneapi/ccl/2021.9.0/lib/cpu_gpu_dpcpp/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib/ \
-L/usr/lib64/gcc/x86_64-suse-linux/7/../../../ \
-L/lib64 \
-L/lib/ \
-L/usr/lib64 \
-L/usr/lib \
/tmp/ifort40QEgi.o \
-Bdynamic \
-Bstatic \
-lifport \
-lifcoremt \
-limf \
-lsvml \
-Bdynamic \
-lm \
-Bstatic \
-lipgo \
-lirc \
-Bdynamic \
-lpthread \
-Bstatic \
-lsvml \
-Bdynamic \
-lc \
-lgcc \
-lgcc_s \
-Bstatic \
-lirc_s \
-Bdynamic \
-ldl \
-lc \
/usr/lib64/gcc/x86_64-suse-linux/7/crtend.o \
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crtn.o
rm /tmp/ifortdashvCInC0i
rm /tmp/ifortdummyd8rMxh.c
rm /tmp/ifortsearchdirsD2Nq2h
rm /tmp/ifortgccdashvstZevi
rm /tmp/ifort40QEgi.o
rm /tmp/ifortgdctnias_.s
rm /tmp/ifortldashvsksa9i
rm /tmp/iforttempfileaVdbph
rm /tmp/ifortargEj1yWi
rm /tmp/ifort40QEgi.o
Avoided divide by zero
test/test_gcd>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran does not provide mandatory short-circuit evaluation (see, for example, this page), so the statement
IF ((B .NE. 0) .AND. (MOD(A,B) .GT. 0)) THEN
is in error if B is zero. Replace by, e.g.,
IF (B .NE. 0) THEN
IF (MOD(A,B) .GT. 0) THEN
...
END IF
...
END IF
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran does not provide mandatory short-circuit evaluation (see, for example, this page), so the statement
IF ((B .NE. 0) .AND. (MOD(A,B) .GT. 0)) THEN
is in error if B is zero. Replace by, e.g.,
IF (B .NE. 0) THEN
IF (MOD(A,B) .GT. 0) THEN
...
END IF
...
END IF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your question. We converted it to a feature request asking the compiler to provide a warning when short-circuiting is used.
We will no longer respond to this thread.
If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On reading the Fortran article it says
val=0.0
if(val.ne.0 .and. (top/val.gt.10.0) )then ! DO NOT DO THIS
write(*,*)'met conditions'
endif
So when can you use .and.,
so top/val throws an exception, will it not throw an exception if you nest the if's.
Also as val is a real then when you assign val = 0.0 you will likely get 0.0000000001489
I have noticed that in the assignments in my new program, if I set a = 0.1 and b = 0.2 then the 1489 is twice that number in b, it is really weird, the error in the assignment is not random.
There is no real zero with the equal operator?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>will it not throw an exception if you nest the if's?
Yes, the nested format will not throw an exception (with correct code).
IF(Expression1 .operator. Expression2) statement3
Fortran permits (aka requires you to provide for) evaluations of all expressions without specifying order of, nor, consideration as to if any partial accumulated evaluation(s) would yield a T or F.
The nested IF style provides you a means to specify a sequence of operations.
RE: my (with correct code)
With the introduction of SIMD code, and code like
if(x /= 0.0) then
ret = y / x
else
ret = y / q
endif
compiler optimizations can conceivably perform both paths of the IF code as a single instruction, then apply the operator.
"with correct code" requires the compiler generated code to handle the case of x==0.0 without generation of an error.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is when you declare X, it will not be exactly zero. The Intel Fortran compiler always has a small positive component at the end. You can test that X is close to zero, you cannot test it is zero and be assured it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>The Intel Fortran compiler always has a small positive component at the end.
Not so.
program Console21
implicit none
real :: x
x = 1.0
do
x = x / 2.0
print '(F,Z)', x, x
if(x==0.0) exit
end do
end program Console21
0.5000000 3F000000
0.2500000 3E800000
0.1250000 3E000000
0.0625000 3D800000
...
0.0000038 36800000
0.0000019 36000000
0.0000010 35800000
0.0000005 35000000
0.0000002 34800000
0.0000001 34000000
0.0000001 33800000 ! prints as 0.0000001, actual value 0.00000005
0.0000000 33000000 ! these subnormals /= 0.0 but print as 0.0
0.0000000 32800000
0.0000000 32000000
0.0000000 31800000
0.0000000 31000000
0.0000000 30800000
0.0000000 30000000
...
0.0000000 80
0.0000000 40
0.0000000 20
0.0000000 10
0.0000000 8
0.0000000 4
0.0000000 2
0.0000000 1 ! lowest sub normal
0.0000000 0 ! finally 0.0
While a number may print as 0.0, it is not necessarily 0.0.
If I change the format E,F,Z, you will see the values are decreasing to 0.0
0.1121039E-43 0.0000000 8
0.5605194E-44 0.0000000 4
0.2802597E-44 0.0000000 2
0.1401298E-44 0.0000000 1
0.0000000E+00 0.0000000 0
Jim Dempsey
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page