Skip to content

[Flang] Compile error when argument keyword is specified in argument of c_sizeof intrinsic module function #133670

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

Closed
ohno-fj opened this issue Mar 31, 2025 · 2 comments
Labels
duplicate Resolved as duplicate flang:frontend

Comments

@ohno-fj
Copy link

ohno-fj commented Mar 31, 2025

Version of flang : 21.0.0(b2b3cb5f76f15d38e67f70124d275a5696bfdb83)/AArch64

When argument keyword is specified in argument (actual argument specifier) of c_sizeof intrinsic module function, a compilation error occurs.
Although the types of intrinsic module functions are different, this issue is similar to [128610] (#128610).

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

sngtm016_2.f90:

program main
  use iso_c_binding
  real(c_float) :: r
  real(c_float),pointer ::p
  type(c_ptr) :: leftptr
  print *,c_sizeof(r)
  print *,c_sizeof(x=r)
  leftptr=c_loc(x=p)
end program main
$ flang sngtm016_2.f90
error: Semantic errors in sngtm016_2.f90
./sngtm016_2.f90:7:20: error: unknown keyword argument to intrinsic 'sizeof'
    print *,c_sizeof(x=r)
                     ^
$
$ gfortran sngtm016_2.f90; ./a.out
                    4
                    4
$
$ ifx sngtm016_2.f90; ./a.out
                     4
                     4
$
@llvmbot
Copy link
Member

llvmbot commented Mar 31, 2025

@llvm/issue-subscribers-flang-frontend

Author: None (ohno-fj)

``` Version of flang : 21.0.0(b2b3cb5)/AArch64 ```

When argument keyword is specified in argument (actual argument specifier) of c_sizeof intrinsic module function, a compilation error occurs.
Although the types of intrinsic module functions are different, this issue is similar to [128610] (#128610).

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

sngtm016_2.f90:

program main
  use iso_c_binding
  real(c_float) :: r
  real(c_float),pointer ::p
  type(c_ptr) :: leftptr
  print *,c_sizeof(r)
  print *,c_sizeof(x=r)
  leftptr=c_loc(x=p)
end program main
$ flang sngtm016_2.f90
error: Semantic errors in sngtm016_2.f90
./sngtm016_2.f90:7:20: error: unknown keyword argument to intrinsic 'sizeof'
    print *,c_sizeof(x=r)
                     ^
$
$ gfortran sngtm016_2.f90; ./a.out
                    4
                    4
$
$ ifx sngtm016_2.f90; ./a.out
                     4
                     4
$

@klausler
Copy link
Contributor

klausler commented Apr 1, 2025

Duplicates #128610, already fixed.

@klausler klausler closed this as completed Apr 1, 2025
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Resolved as duplicate flang:frontend
Development

No branches or pull requests

4 participants