0

I'm working on porting the flang (LLVM) fortran compiler to windows. One problem I ran into that I need help with is the following:

fatal error: error in backend: alignment is limited to 32-bytes

This happens when compiling some fortran files and is from here:

https://github.com/llvm-mirror/llvm/blob/806f68bbab5118c0252fdeaf1d84fc17ba9dae5c/lib/MC/MCWinCOFFStreamer.cpp#L230

What does this mean and will it be difficult to resolve it?

Fortran source

  DOUBLE PRECISION FUNCTION D1MACH(I)
  COMMON /D9MACH/ CRAY1
  RETURN
  END

Update: the following LLVM is generated:

 @d9mach_ = common global %structd9mach_  zeroinitializer, align 64

What is the implication of this?

xaav
  • 7,876
  • 9
  • 30
  • 47
  • This very likely.completely outside of my expertise, but which Fortran files? Which flang it is? The PGI ones? There were two project with this name. – Vladimir F Героям слава Oct 30 '17 at 08:35
  • There is only one flang active project by PGI. I can give you the Fortran files but not sure how that will help. – xaav Oct 30 '17 at 15:40
  • This is a very difficult problem hence the question. – xaav Oct 30 '17 at 15:43
  • I think you might potentially find [Memory alignment in C structs](https://stackoverflow.com/questions/5435841/memory-alignment-in-c-structs) useful, or [this Wiki link](https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86). I'm totally guessing, since I also don't have the expertise to say for sure what the issue is. – Matt P Oct 30 '17 at 18:12
  • Actually the fortran to generate this error is not so complicated, so let me post it. – xaav Oct 30 '17 at 18:17
  • wrong file, removed – xaav Oct 30 '17 at 18:54
  • An example where this error occurs is this file, https://github.com/Reference-LAPACK/lapack/blob/08de2d99341f67f36bc66af53785880bbfb6c968/TESTING/LIN/schkaa.f – isuruf Oct 30 '17 at 18:55

1 Answers1

0

In the LLVM IR, the "align" argument cannot be more than 32 bytes on windows. If it is greater than that, you will need to reduce it to 32 (just find where that is written and modify it).

xaav
  • 7,876
  • 9
  • 30
  • 47