Problem with 'alloca', and pgf95

Morning,

I am getting the following error when I compile a basic function, when I compile the same code as a subroutine it works… Just wondering if this is a known issue ? or just me ?

/ethos/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/share/llvm/bin/llc: error: /ethos/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/share/llvm/bin/llc: /tmp/nvfortrandpQhjoDn9kaj.ll:2497:34: error: invalid type for alloca
%migkdep3_sumtooutput_ = alloca i32 (ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr), align 8

All the variables are declared and typed correctly I believe. I am in opensuse, and using version23.7. Any clues on how to get the code to give me a clue as to what is wrong ? I have tried commenting out variables one by one etc etc

The snippet of the code looks like

   integer function migkdep3_sumtooutput(
 &                       !!finetrace,
 &                       hdrsin,
 &                       shtx,shty,shtz,recx,recy,recz,
 &                       outtrace,hdrout,
 &                       cdpxyz,.............)

but when I do

subroutine migkdep3_sumtooutput(
c & !!finetrace,
c & hdrsin,
c & shtx,shty,shtz,recx,recy,recz,
c & outtrace,hdrout,…

it works… with same compiler flags etc

Thank you

sorry, the commented bits should not be there…so many tries at this, I am ‘comment blind’ ! but the point it the same, a function, not behaving as subroutine… thanks

Hi grogf,

Unfortunately I’m not sure what’s wrong. Can you please provide a minimal reproducing example so I can investigate?

Thanks,
Mat

Mat,

Thanks for your prompt reply. The problem is that I get an error when I compile using the pgf95 (version 23.7). The same error occurs I several different scenarios which is why it is causing issues. The error is

/ethos/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/share/llvm/bin/llc: error: /ethos/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/compilers/share/llvm/bin/llc: /tmp/nvfortranBCXgr_dfvmfZ.ll:505:34: error: invalid type for alloca

%migkdep3_sumtooutput_ = alloca i32 (ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr), align 8

As you can see in the snapshot there is a little green arrow, that may of may not indicate what is causing the error, but it moves around depending on the number of variables being passed. The error also comes and goes depending on the flags used. In the example above uses the most basic flags, but if I use more complex ones like these…. The problem ‘sometimes’ goes away.

pgf95 -DETHOS_OS=1005 -DLINUX=1005 -DFFT=FFTPACK2 -fast -Mflushz -acc -gpu=cc60,lineinfo,pinned -Minline,reshape -mp -tp px -fPIC -Mlfs -Mnomain -Minform=inform -Minline -Mcache_align -Mlarge_arrays -DOPENMP -I./ -c -o test2.o test2.F

anyways I attach two files that should allow you to easily re-create the issue (famous last words) ……. I have commented 3 lines that control the appearance of the error message. If I rename the variables sometimes the error appear or dissaperars, I leave 2 lines comment out the problem foes away again !! As I mention the problem shows no consistent behavior and many other changes make it appear (i.e. number of variables being passed to the function) other pic below where I add more variables to the function…… and if I change the function to a subroutine…. Then some times that makes it go away !!!

Thank you for your time. Hopefully its something simple !

To compile you can simply use

Pgf95 -c -o test2.o test2.F

I am happy to provide more info, thanks again

Cheers

Grog

test2.F (1.35 KB)

test2.finc (2.76 KB)

Hi Grog,

Looks like we’re not catching an error in your code which causes the compiler code gen to go down a bad path.

The issue with the code is that “migkdep3_sumtooutput” is declared as a function but you’re calling it as a subroutine. Either switching it back to be declared as a subroutine or calling it as a function by catching the return code will fix the issue.

Hope this helps,
Mat

Thank you ………will give that another whirl tomorrow, but I must say I have tried the ‘subroutine’ route before, and it still did not seem to fly. I will try again. Home time here !

Cheers

Fabulous thank you very much. You were absolutely correct changing ‘call’ to a function return variable did the trick. Such a simple thing as it turns out eventually !!

I really appreciate you helping.

Thanks again

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.