CFITSIO code crashes NV compiler with -O2

Hi,

I am building the cfitsio library (FITSIO Home Page) with NV 22.11
The code has always built fine but now the compilation seg faults the compiler:
pgcc-Fatal-/home/psi/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/cpp2 TERMINATED by signal 11

If I force the build to use “-O1” instead of “-O2” it builds fine.

I am building version 3410:
https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfit3410.zip

– Ron

Hi Ron,

For good or bad, I’m not able to reproduce this error. Here what I did:

% wget https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfit3410.zip
% unzip cfit3410.zip
% mkdir build
% cd build
% cmake ../ -DCMAKE_C_FLAGS="-O2"
% make

Am I missing something?

Do you know the specific file that causing the error?

-Mat

Hi,

What happens if you do not specify the -DCMAKE_C_FLAGS=“-O2”?
We just run the configuration script with --enable-shared --enable-production and our CC is set to eh compatible pgcc etc.

  • Ron

Cmake doesn’t add any flags.

I get syntax errors with configure (different ones depending on the shell used).

Can you post the compile line that’s causing the error? It may be easier than me trying to figure out what’s wrong with configure.

-Mat

Hi,

Here is the output:

getcolj.c
pgcc -c -o ./getcolk.o -g -O2  -fPIC  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -DHAVE_LIMITS_H=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_FTRUNCATE=1 -DHAVE_LONGLONG=1 -DHAVE_SHMEM_SERVICES=1 -DHAVE_NET_SERVICES=1 getcolk.c
pgcc-Fatal-/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/cpp2 TERMINATED by signal 11
Arguments to /opt/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/cpp2
/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/cpp2 fitscore.c -debug -x 120 0x8000 -opt 2 -terse 1 -inform warn -x 119 0xa10000 -x 122 0x40 -x 123 0x1000 -x 127 4 -x 127 17 -x 19 0x400000 -x 28 0x40000 -x 120 0x10000000 -x 70 0x8000 -x 122 1 -x 125 0x20000 -quad -vect 56 -y 34 16 -x 37 0x480000 -x 34 0x8 -x 32 31457280 -y 19 8 -y 35 0 -x 42 0x30 -x 39 0x40 -x 42 0x20000 -x 39 0x80 -x 59 4 -x 129 2 -y 129 0x8000 -tp haswell -astype 0 -x 121 1 -fn fitscore.c -il /tmp/nvcFVNlgDFsiQNir.il -x 123 0x80000000 -x 123 4 -x 119 0x20 -def __pgnu_vsn=90400 -x 70 0x40000000 -x 183 4 -x 121 0x800 -x 6 0x20000 -x 122 0x400000 -y 125 0x100000 -autoinl 10 -x 168 400 -x 174 128000 -x 14 0x200000 -x 14 0x400000 -autoinl 10 -x 168 400 -x 174 128000 -x 14 0x200000 -x 14 0x400000 -x 249 140 -x 120 0x200000 -x 70 0x40000000 -x 8 0x40000000 -x 164 0x800000 -x 71 0x2000 -x 71 0x4000 -x 34 0x40000000 -x 83 0x1 -x 85 0x1 -x 15 0x1000000 -x 206 0x02 -x 120 0x1000000 -x 68 0x1 -x 39 4 -x 56 0x10 -x 26 0x10 -x 26 1 -x 56 0x4000 -x 197 0 -x 175 0 -x 203 0 -x 204 0 -y 163 0xc0000000 -x 192 0x40000000 -x 189 0x10 -y 189 0x4000000 -x 60 512 -x 9 1 -x 72 0x1 -x 136 0x11 -x 9 1 -x 72 0x1 -x 136 0x11 -x 62 8 -gnuvsn 90400 -x 69 0x200 -x 123 0x400 -x 119 0x08 -cmdline '+pgcc /tmp/nvcFVNlgDFsiQNir.il -c -o ./fitscore.o -g -O2 -Mvect=simd -Mno-signed-zeros -fPIC -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MATH_H=1 -DHAVE_LIMITS_H=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_FTRUNCATE=1 -DHAVE_LONGLONG=1 -DHAVE_SHMEM_SERVICES=1 -DHAVE_NET_SERVICES=1' -asm /tmp/nvcpVNlgTZzUGzsh.ll
make[1]: *** [Makefile:131: fitscore.o] Error 127
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/caplanr/tmp/tmp/cfitsio'
make: *** [Makefile:88: all] Error 2

– Ron

Thanks Ron.

It’s the “fitscore.c” file that’s causing the error and appears to only occur with the combination of both “-g -O2” and why I didn’t see it before. I’ve filed TPR#32764 and have asked engineering to investigate.

Work arounds are to remove “-g” or add the internal compiler flag " -Mx,37,0x20" which disables the loop idiom recognition optimization which where the segv occurs.

-Mat

1 Like