Skip to content

Segmentation Fault in Elemsd_SetJs on GCC 16.x.x #337

@shishiousan

Description

@shishiousan

The part of error message is given below.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f77e32249a6 in ???
#1  0x7f77e3223555 in ???
#2  0x7f77dc43e8ef in ???
#3  0x7f77edb58e31 in __elemshapedata_setmethods_MOD_elemsd_setjs
	at /home/shion/Dropbox/easifem/base/src/submodules/ElemshapeData/src/ElemshapeData_SetMethods@Methods.F90:104
#4  0x7f77edb4c787 in __elemshapedata_setmethods_MOD_elemsd_set1
	at /home/shion/Dropbox/easifem/base/src/submodules/ElemshapeData/src/ElemshapeData_SetMethods@Methods.F90:237
#5  0x7f77ef888e4b in __abstract1dsdmixedfem_class_MOD_obj_setelemsdforspace

The error occurs here. (ElemshapeData_SetMethods@Methods.F90:104)

  DO ips = 1, obj%nips
    obj%js(ips) = Det(obj%jacobian(1:obj%nsd, 1:obj%xidim, ips))
  END DO

My source code where the error occur is this.

TYPE(ElemShapeData_), Pointer :: elemsd, linElemsd

CALL ElemsdSet(obj=elemsd, val=xij(1:1, :), N=linElemsd%N(1:2, 1:nips), &
               dNdXi=linElemsd%dNdXi(1:2, 1:1, 1:nips))

This error occurs only when the base and other libraries are compiled with gcc 16.x.x.

I checked the all components of elemsd in my source code as follows

TYPE(ElemShapeData_), Pointer :: elemsd, linElemsd
 
CALL Display(elemsd%nips, "nips:: ")  ! it returns 3 in my case. 
CALL Display(elemsd%jacobian(1:elemsd%nsd, 1:elemsd%xidim,  1:elemsd%nips), "jacobian :: ")
CALL Display(elemsd%js(1:elemsd%nips), "js :: ")

!! will error occur ?
CALL Display(Det(elemsd%jacobian(1:elemsd%nsd, 1:elemsd%xidim, 1)), "det1::")
CALL Display(Det(elemsd%jacobian(1:elemsd%nsd, 1:elemsd%xidim, 2)), "det2::")
CALL Display(Det(elemsd%jacobian(1:elemsd%nsd, 1:elemsd%xidim, 3)), "det3::")

!! CALL ElemsdSet(obj=elemsd, val=xij(1:1, :), N=linElemsd%N(1:2, 1:nips), &
               dNdXi=linElemsd%dNdXi(1:2, 1:1, 1:nips))

In this raw code, no error occurs.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions