diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -815,7 +815,7 @@ void CompilerInvocation::setSemanticsOpts( Fortran::parser::AllCookedSources &allCookedSources) { - const auto &fortranOptions = getFortranOpts(); + auto &fortranOptions = getFortranOpts(); semanticsContext = std::make_unique( getDefaultKinds(), fortranOptions.features, allCookedSources); @@ -829,10 +829,14 @@ llvm::Triple targetTriple{llvm::Triple(this->targetOpts.triple)}; // FIXME: Handle real(3) ? - if (targetTriple.getArch() != llvm::Triple::ArchType::x86 && - targetTriple.getArch() != llvm::Triple::ArchType::x86_64) { + if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) { semanticsContext->targetCharacteristics().DisableType( Fortran::common::TypeCategory::Real, /*kind=*/10); + } else { + const auto &preprocessorOptions = getPreprocessorOpts(); + if (preprocessorOptions.macrosFlag == PPMacrosFlag::Include) { + fortranOptions.predefinitions.emplace_back("__x86_64__", "1"); + } } } diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt --- a/flang/tools/f18/CMakeLists.txt +++ b/flang/tools/f18/CMakeLists.txt @@ -39,7 +39,7 @@ endif() add_custom_command(OUTPUT ${base}.mod COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR} - COMMAND flang-new -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} + COMMAND flang-new -fc1 -cpp -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} ${FLANG_SOURCE_DIR}/module/${filename}.f90 DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} )