Several module files in .../llvm-project/flang/module check for the existence of the macro "__x86_64__" to conditionally compile Fortran code. Unfortunately, this macro was not being defined anywhere. This patch fixes that for compilations targeting 64 bit x86 machines. I made the following changes -- -- Removed the test for 32 bit X86 targets. The rest of the compiler and runtime do not support X86 32 bits. -- Added predefined macros to define "__x86_64__" and "__x86__64" to be 1 when the target architecture is 64 bit x86 and the "-cpp" option is on the command line. -- Changed the cmake file for creating the Fortran module files to use the "-cpp" option so that the macro "__x86_64__" will be defined when building the module files. -- Added a test. Differential Revision: https://reviews.llvm.org/D135810
17 lines
341 B
Fortran
17 lines
341 B
Fortran
! Test predefined macro for 64 bit X86 architecture
|
|
|
|
! REQUIRES: x86-registered-target
|
|
|
|
! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -cpp -E %s | FileCheck %s
|
|
|
|
! CHECK: integer :: var1 = 1
|
|
! CHECK: integer :: var2 = 1
|
|
|
|
#if __x86_64__
|
|
integer :: var1 = __x86_64__
|
|
#endif
|
|
#if __x86_64__
|
|
integer :: var2 = __x86_64
|
|
#endif
|
|
end program
|