Skip to content
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

"constant expression type mismatch" for valid code #424

Open
dev-zero opened this issue Mar 22, 2018 · 9 comments
Open

"constant expression type mismatch" for valid code #424

dev-zero opened this issue Mar 22, 2018 · 9 comments
Labels

Comments

@dev-zero
Copy link

@dev-zero dev-zero commented Mar 22, 2018

given the following two files

dbcsr_data_types.f90:

module dbcsr_data_types
   TYPE dbcsr_data_obj
      TYPE(dbcsr_data_area_type), POINTER           :: d => Null()
   END TYPE dbcsr_data_obj

   TYPE dbcsr_mempool_type
      TYPE(dbcsr_mempool_entry_type), POINTER :: root => Null()
      INTEGER                                 :: capacity = 1
   END TYPE dbcsr_mempool_type

   TYPE dbcsr_mempool_entry_type
      TYPE(dbcsr_data_obj)                    :: area
      TYPE(dbcsr_mempool_entry_type), POINTER :: next => Null()
   END TYPE dbcsr_mempool_entry_type

   TYPE dbcsr_memtype_type
      TYPE(dbcsr_mempool_type), POINTER :: pool => Null()
   END TYPE dbcsr_memtype_type

   TYPE(dbcsr_memtype_type), PARAMETER :: dbcsr_memtype_default = dbcsr_memtype_type(pool=Null())

   TYPE dbcsr_data_area_type
      INTEGER                                  :: ref_size = -1
      INTEGER                                  :: refcount = -1
      INTEGER                                  :: id = -1
      TYPE(dbcsr_memtype_type)                 :: memory_type = dbcsr_memtype_default
      INTEGER                                  :: data_type = -1
   END TYPE dbcsr_data_area_type

end module

dbcsr_data_types_user.f90:

module a
   use dbcsr_data_types, only: dbcsr_memtype_type

   type foo
      type(dbcsr_memtype_type) :: val = dbcsr_memtype_type()
   end type
end module

trying to compile them using

flang -c dbcsr_data_types.f90
flang -c dbcsr_data_types_user.f90

gives

/tmp/dbcsr_data_types_user-985010.ll:9:47: error: constant expression type mismatch
@_a_10_ = global %struct_a_10_ < { [16 x i8]  [i8 0,i8 0,i8 0,i8 0,i8 0,i8 0,i8 0,i8 0]  } > , align 64
                                              ^
1 error generated.

for dbcsr_data_types_user.f90.

Works with gfortran-4.8 and gfortran-8.

@pawosm-arm
Copy link
Contributor

@pawosm-arm pawosm-arm commented May 1, 2018

I tried some crazy hack that emits zeroinitializer instead of calling put_skip() for emitting stream of "i8 0"'s, seems to solve this issue.

@pawosm-arm
Copy link
Contributor

@pawosm-arm pawosm-arm commented May 1, 2018

Sadly, fixing this issue does not make cp2k buildable, still fix for #239 is needed.

pawosm-arm added a commit to pawosm-arm/flang that referenced this issue Jun 22, 2018
…lang-compiler#424)

Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
pawosm-arm added a commit to pawosm-arm/flang that referenced this issue Jun 22, 2018
…lang-compiler#424)

Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
pawosm-arm added a commit to pawosm-arm/flang that referenced this issue Aug 3, 2018
…lang-compiler#424)

Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
@sscalpone sscalpone reopened this Aug 4, 2018
@sscalpone
Copy link
Member

@sscalpone sscalpone commented Aug 4, 2018

@pawosm-arm -- I was not able to verify that this issue was fixed by bc824d3

(#511). What do you think?

pawosm-arm added a commit to pawosm-arm/flang that referenced this issue Aug 5, 2018
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
@pawosm-arm
Copy link
Contributor

@pawosm-arm pawosm-arm commented Aug 5, 2018

But... it's not how my commit looked like! I guess it was malformed by changes made by further commit to the code around. Corrections are introduced by a new pull-request #561

@pawosm-arm
Copy link
Contributor

@pawosm-arm pawosm-arm commented Sep 7, 2018

I guess it's time to pull the request and close this one.

@sscalpone
Copy link
Member

@sscalpone sscalpone commented Sep 7, 2018

Working on it.... Waiting until the big C++ pull is finished.

pawosm-arm added a commit to pawosm-arm/flang that referenced this issue Nov 1, 2018
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
@gklimowicz
Copy link
Collaborator

@gklimowicz gklimowicz commented Jun 6, 2019

@pawosm-arm: Does this still need the pull request #561 to satisfy this?

@pawosm-arm
Copy link
Contributor

@pawosm-arm pawosm-arm commented Jun 7, 2019

@gklimowicz yes, I've made a mistake preparing initial pull request, unfortunately, before I noticed that, it was already accepted. #561 corrects the change that was pulled in and fixes the initial issue #424

@gklimowicz
Copy link
Collaborator

@gklimowicz gklimowicz commented Jun 7, 2019

@pawosm-arm Thanks. I will close this when PR #561 is handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.