Search code examples
fortranbuffer-overflowabaqus

Buffer overflow from print statement in fortran


I'm trying to edit an old Abaqus user subroutine for my own project. I am attempting to debug some segmentation faults using print statements (on a university computer and the code requires input from abaqus so using a proper debugger is not possible), however, when I use a print statement it aborts with a message saying: *** buffer overflow detected ***: *path* terminated.

The first few (5 maybe?) times I ran it this morning it actually worked and printed as expected, but then stopped. I've tried using call flush(6) to clear out the buffer but that didn't help. Should I be using a different unit? Or clearing the buffer a different way? Or something else entirely?

I'm new to Fortran and only kind of experienced with programming in general so please any advice on this issue would be appreciated!

Here's the relevant portion of my code:

SUBROUTINE UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,
    1  RPL,DDSDDT,DRPLDE,DRPLDT,STRAN,DSTRAN,TIME,DTIME,
    2  TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,NSHR,NTENS,
    3  NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,
    4  DFGRD0,DFGRD1,NOEL,NPT,KSPT,KINC)

     INCLUDE 'ABA_PARAM.INC'
     CHARACTER*80 CMNAME

     DIMENSION STRESS(NTENS),STATEV(NSTATV),
    1  DDSDDE(NTENS,NTENS),DDSDDT(NTENS),DRPLDE(NTENS),
    2  STRAN(NTENS),DSTRAN(NTENS),TIME(2),PREDEF(1),DPRED(1),
    3  PROPS(NPROPS),COORDS(3),DROT(3,3),
    4  DFGRD0(3,3),DFGRD1(3,3)
    
     dt = DTIME
       
     print *, "TEMP", TEMP 

Note: I believe this is using fortran 90 and intel 2020


Solution

  • It turns out that using write(6, *) "TEMP: ", TEMP does what I need without the buffer overflow which is good enough for me