# \*EL PRINT ELKE in a linear \*STATIC or \*BUCKLE step: segmentation fault (resultsmech.f reads the velocities, which linstatic.c and arpackbu.c pass as NULL)

**URL:** <https://calculix.discourse.group/t/el-print-elke-in-a-linear-static-or-buckle-step-segmentation-fault-resultsmech-f-reads-the-velocities-which-linstatic-c-and-arpackbu-c-pass-as-null/4301>\
**Category:** Analysis issues\
**Created:** [November 3, 2026, 9:19pm UTC](https://calculix.discourse.group/t/el-print-elke-in-a-linear-static-or-buckle-step-segmentation-fault-resultsmech-f-reads-the-velocities-which-linstatic-c-and-arpackbu-c-pass-as-null/4301 "2026-11-03T21:19:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandervdb](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sandervdb](https://calculix.discourse.group/u/Sandervdb)\
**Post date:** [November 3, 2026, 9:19pm UTC](https://calculix.discourse.group/t/el-print-elke-in-a-linear-static-or-buckle-step-segmentation-fault-resultsmech-f-reads-the-velocities-which-linstatic-c-and-arpackbu-c-pass-as-null/4301/1 "2026-11-03T21:19:55Z")

</div>

## Summary

Section 7.53 (\*EL PRINT) of the 2.23 manual lists “the kinetic energy (key=ELKE)” among the whole-element variables, without restricting it to dynamic steps. Requested in a step that ccx runs linearly, it crashes ccx with a segmentation fault (exit 139) at the first stress calculation, and nothing is printed after the banner. Affected: a linear `*STATIC` step (also one that follows a `*FREQUENCY` or `*BUCKLE` step, e.g. explicit `*DYNAMIC`, then `*FREQUENCY`, then `*STATIC`) and `*BUCKLE`. The same step with ELSE instead of ELKE runs, and so does the same request in an NLGEOM `*STATIC` step or a `*DYNAMIC` step.

For a `*FREQUENCY` step ccx already handles this request (`calinput.f`, master lines 1492-1510): it drops ELKE and warns

```auto
 *WARNING in calinput: ELKE-output requested
          this is not available in a
          frequency calculation: ELKE
          is deactivated in this and all
          subsequent steps (unless reactived
          explicitly)

```

## Version

ccx 2.23 (macOS arm64) and current master (537aa81, built on macOS arm64): the same results. Source: master 537aa81.

## Already reported or fixed?

Not reported: I found no matching GitHub issue (open or closed) or pull request in Dhondtguido/CalculiX, and no calculix.discourse.group topic (checked 3 Nov 2026). Not fixed: `linstatic.c`, `arpackbu.c` and `resultsmech.f` are unchanged in this respect on master (537aa81).

Related:

- [Linear \*STATIC step: \*EL FILE with SDV segfaults when the model has \*DEPVAR (xstaten is never allocated in linstatic.c) · Issue #221 · Dhondtguido/CalculiX · GitHub](https://github.com/Dhondtguido/CalculiX/issues/221) and pull request [Sign in to GitHub · GitHub](https://github.com/Dhondtguido/CalculiX/pull/234:) SDV on `*EL FILE` in a linear static step crashes on another array that `linstatic.c` does not allocate (`xstaten`). A build of master 9ba5d76 with #234 still crashes on the deck below.
- [Issues · Dhondtguido/CalculiX · GitHub](https://github.com/Dhondtguido/CalculiX/issues/285:) plastic, creep and user materials crash in the same routines (`linstatic.c`, `arpackbu.c`) on other arrays they leave unallocated (`xstateini`, `vini`, `stiini`, `emeini`). Here the material is elastic and the array is `veold`.

## Minimal input

`elke_static.inp`:

```auto
** One C3D8 cube, base held, a load on the top face, linear *STATIC step,
** kinetic energy (ELKE) requested on *EL PRINT.
*NODE, NSET=NALL
1, 0., 0., 0.
2, 1., 0., 0.
3, 1., 1., 0.
4, 0., 1., 0.
5, 0., 0., 1.
6, 1., 0., 1.
7, 1., 1., 1.
8, 0., 1., 1.
*ELEMENT, TYPE=C3D8, ELSET=EALL
1, 1, 2, 3, 4, 5, 6, 7, 8
*NSET, NSET=BOT
1, 2, 3, 4
*NSET, NSET=TOP
5, 6, 7, 8
*MATERIAL, NAME=M
*ELASTIC
1000., 0.3
*DENSITY
1.E-3
*SOLID SECTION, ELSET=EALL, MATERIAL=M
*BOUNDARY
BOT, 1, 3
*STEP
*STATIC
*CLOAD
TOP, 3, 0.25
*EL PRINT, ELSET=EALL
ELKE
*END STEP

```

Variants (one change each):

| deck | change |
| --- | --- |
| `else_static.inp` | `ELSE` instead of `ELKE` |
| `elke_nlgeom.inp` | `*STEP, NLGEOM` |
| `elke_dynamic.inp` | `*DYNAMIC` / `0.1, 1.` instead of `*STATIC` |
| `elke_buckle.inp` | `*BUCKLE` / `2` instead of `*STATIC`, load `TOP, 3, -0.25` |
| `else_buckle.inp` | `elke_buckle.inp` with `ELSE` |
| `elke_freq_static.inp` | a step `*FREQUENCY` / `2` before the static step |
| `elke_expl_freq_static.inp` | two steps before the static step: `*STEP, INC=100000` / `*DYNAMIC, EXPLICIT` / `1.E-5, 1.E-3` / `*EL PRINT, ELSET=EALL` / `ELKE` / `*END STEP`, then `*STEP` / `*FREQUENCY` / `2` / `*END STEP` |
| `elke_freq.inp` | `*FREQUENCY` / `2` instead of `*STATIC` and its `*CLOAD` lines |

## How to run

`ccx elke_static` (and the variants the same way)

## Expected

The step runs and prints a kinetic energy of 0 (the step is static), or ccx drops the request with a warning, as it does in a `*FREQUENCY` step.

## Actual

| deck | ccx 2.23 | master 537aa81 |
| --- | --- | --- |
| `elke_static` | segmentation fault (139) | segmentation fault (139) |
| `elke_buckle` | segmentation fault | segmentation fault |
| `elke_freq_static` | segmentation fault | segmentation fault |
| `elke_expl_freq_static` | segmentation fault | segmentation fault |
| `else_static`, `else_buckle` | exit 0 | exit 0 |
| `elke_nlgeom` | exit 0, ELKE 1.418507E-10 | the same |
| `elke_dynamic` | exit 0, ELKE 6.560558E-07 | the same |
| `elke_freq` | exit 0, the warning above | the same |

Under lldb the crash is a read at address 0x8 in `resultsmech_`.

## Where it goes wrong

A request for ELKE sets `ikin=1` (`resultsini.c`, master lines 326-332). `resultsmech.f` then copies the element’s nodal velocities (lines 458-463):

```fortran
        elseif(ikin.eq.1) then
          do j=1,nope
            do k=1,3
              veoldl(k,j)=veold(k,konl(j))
            enddo
          enddo            
        endif

```

`linstatic.c` declares the velocities only as dummy arguments for its `results()` calls (line 120: `double *veold=NULL,*accold=NULL,...`), and so does `arpackbu.c` (line 112). `veold(1,1)` is then the address 0x8.

## Fix

Possible fix (not built or tested): in `linstatic.c` and `arpackbu.c`, allocate `veold` with zeros when ELKE is requested (the kinetic energy of a static step is 0), or drop ELKE with a warning for these procedures, as `calinput.f` does for `*FREQUENCY` (master lines 1492-1510).

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [November 3, 2026, 11:06pm UTC](https://calculix.discourse.group/t/el-print-elke-in-a-linear-static-or-buckle-step-segmentation-fault-resultsmech-f-reads-the-velocities-which-linstatic-c-and-arpackbu-c-pass-as-null/4301/2 "2026-11-03T23:06:38Z")

</div>

Confirmed using official ccx 2.23 build on Windows, needs a GitHub ticket.

The analysis (elke\_static) indeed crashes.

---

<div class="post-metadata">

**Author:** ![Sandervdb](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sandervdb](https://calculix.discourse.group/u/Sandervdb)\
**Post date:** [November 4, 2026, 6:40am UTC](https://calculix.discourse.group/t/el-print-elke-in-a-linear-static-or-buckle-step-segmentation-fault-resultsmech-f-reads-the-velocities-which-linstatic-c-and-arpackbu-c-pass-as-null/4301/3 "2026-11-04T06:40:16Z")

</div>

Posted: [\*EL PRINT ELKE in a linear \*STATIC or \*BUCKLE step: segmentation fault (resultsmech.f reads the velocities, which linstatic.c and arpackbu.c pass as NULL) · Issue #321 · Dhondtguido/CalculiX · GitHub](https://github.com/Dhondtguido/CalculiX/issues/321)
