armflang #include does not work with absolute path

This issue was initially brought to my attention at

With armflang 22.x and the latest 23.04.1, the #include directive does not work as expected.

Instead of opening the file with an absolute path, it tries to append the absolute path to the include directories.

Here is a simple way to evidence the issue:

$ armflang --version

Arm C/C++/Fortran Compiler version 23.04.1 (build number 14) (based on LLVM 16.0.2)

Target: aarch64-unknown-linux-gnu

Thread model: posix

InstalledDir: /opt/arm/arm-linux-compiler-23.04.1_RHEL-8/bin

 more /tmp/include/header.h /tmp/src/main.F90




! dummy header




#include "/tmp/include/header.h"

armflang -c main.F90 

F90-F-0906-Can't find include file /tmp/include/header.h (main.F90: 1)

F90/aarch64 Linux FlangArm F90  - 1.5 2017-05-01: compilation aborted

FWIW, using a relative path works as expected

$ more main2.F90 

#include "../include/header.h"

program main

end program

$ armflang -c main2.F90 


I suspect this is a bug, but if this is a feature/limitation of armflang, please let me know.

FWIW, I tried flang-new from LLVM 15 and 16 but the error does not occur with these compilers.