- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I encountered a strange behavior when using -fPIC and -qopenmp together with ifort (ifort (IFORT) 2021.9.0 20230302 and ifort (IFORT) 2021.10.0 20230609 at least).
I have attached a minimal reproducible example to this message.
A .sh file is used to compile and execute the test with different compiler options:
#!/bin/bash
\rm -f *.o *.mod *.exe
ifort -O2 my_test.f90 -o test.exe
./test.exe
\rm -f *.o *.mod *.exe
ifort -O2 -fPIC my_test.f90 -o test.exe
./test.exe
\rm -f *.o *.mod *.exe
ifort -O2 -qopenmp my_test.f90 -o test.exe
./test.exe
\rm -f *.o *.mod *.exe
ifort -O2 -fPIC -qopenmp my_test.f90 -o test.exe
./test.exe
The expected result is 1.0, but when the two options are used together, the result is 5.0.
Adding a "magic print" works around the problem.
My questions are:
- Are you able to reproduce the behavior?
- Can you confirm that this is a real bug in the compiler (or have I missed something)?
- Is it possible to fix it in the next release?
Best regards,
Raphaël
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I note that this still outputs 5.0 with "ifort -O2 -fPIC -qopenmp my_test.f90", but 1.0 with ifx and the same options in the current OneAPI: ifort 2021.12.0 20240211 / ifx 2024.1.2 20240508. Given that ifort is deprecated, it's unlikely that Intel will fix this with ifort; you are better off switching to ifx, if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thank you for this answer. I will look to switch my code to ifx.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page