Skip to content

[flang] Change c_intmax_t to 64 bit to correspond to intmax_t in C #137208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025

Conversation

eugeneepshteyn
Copy link
Contributor

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change flang's definition of c_intmax_t to be compatible.

Fixes #128609

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Apr 24, 2025
@eugeneepshteyn
Copy link
Contributor Author

@eugeneepshteyn eugeneepshteyn merged commit db53dfc into llvm:main Apr 25, 2025
11 checks passed
@eugeneepshteyn eugeneepshteyn deleted the intmax branch April 25, 2025 14:25
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 25, 2025

LLVM Buildbot has detected a new failure on builder flang-arm64-windows-msvc running on linaro-armv8-windows-msvc-01 while building flang at step 7 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/207/builds/558

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/OpenMP/omp-lib-num-threads.f90' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\flang.exe -fc1 -emit-hlfir -fopenmp -J C:/Users/tcwg/llvm-worker/flang-arm64-windows-msvc/build/runtimes/runtimes-bins/openmp/runtime/src C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90 -o - 2>&1 | c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\filecheck.exe C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90
# executed command: 'c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\flang.exe' -fc1 -emit-hlfir -fopenmp -J C:/Users/tcwg/llvm-worker/flang-arm64-windows-msvc/build/runtimes/runtimes-bins/openmp/runtime/src 'C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90' -o -
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: 'c:\users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin\filecheck.exe' 'C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90'
# .---command stderr------------
# | C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90:24:9: error: CHECK: expected string not found in input
# | !CHECK: fir.call @omp_set_num_threads
# |         ^
# | <stdin>:1:1: note: scanning from here
# | error: Semantic errors in C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90
# | ^
# | <stdin>:1:105: note: possible intended match here
# | error: Semantic errors in C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90
# |                                                                                                         ^
# | 
# | Input file: <stdin>
# | Check file: C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: error: Semantic errors in C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\llvm-project\flang\test\Lower\OpenMP\omp-lib-num-threads.f90 
# | check:24'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:24'1                                                                                                             ?                                  possible intended match
# |             2: C:/Users/tcwg/llvm-worker/flang-arm64-windows-msvc/build/runtimes/runtimes-bins/openmp/runtime/src\omp_lib.mod:513:16: error: Cannot use module file for module 'iso_c_binding': File is not the right module file for 'iso_c_binding': C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin/../include/flang/iso_c_binding.mod 
# | check:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3:  use,intrinsic::iso_c_binding,only:c_ptr 
# | check:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             4:  ^^^^^^^^^^^^^ 
# | check:24'0     ~~~~~~~~~~~~~~~
# |             5: C:/Users/tcwg/llvm-worker/flang-arm64-windows-msvc/build/runtimes/runtimes-bins/openmp/runtime/src\omp_lib.mod:516:6: error: Derived type 'c_ptr' not found 
# | check:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             6:  type(c_ptr)::omp_target_alloc 
# | check:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--
...

@eugeneepshteyn
Copy link
Contributor Author

LLVM Buildbot has detected a new failure on builder flang-arm64-windows-msvc running on linaro-armv8-windows-msvc-01 while building flang at step 7 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/207/builds/558

Was iso_c_binding.mod file not updated somehow on ARM Windows?

2: C:/Users/tcwg/llvm-worker/flang-arm64-windows-msvc/build/runtimes/runtimes-bins/openmp/runtime/src\omp_lib.mod:513:16: error: Cannot use module file for module 'iso_c_binding': File is not the right module file for 'iso_c_binding': C:\Users\tcwg\llvm-worker\flang-arm64-windows-msvc\build\bin/../include/flang/iso_c_binding.mod

@luporl
Copy link
Contributor

luporl commented Apr 25, 2025

Was iso_c_binding.mod file not updated somehow on ARM Windows?

At least on ARM Windows, the change in iso_c_binding.f90 did not cause iso_c_binding.mod to be updated.
A clean build fixed the failure.

jyli0116 pushed a commit to jyli0116/llvm-project that referenced this pull request Apr 28, 2025
…lvm#137208)

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
Copy link
Contributor

@akuhlens akuhlens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137208)

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137208)

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137208)

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
…lvm#137208)

gcc, clang, and other C compiles define intmax_t to be 64 bit. Change
flang's definition of c_intmax_t to be compatible.

Fixes llvm#128609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flang] The value of c_intmax_t defined in iso_c_binding is different for Flang and Gfortran/ifx.
6 participants