Skip to content

Fixed undefined behaviour in VariousWaves_Init.#191

Closed
friedrichatgc wants to merge 1 commit intoOpenFAST:devfrom
friedrichatgc:undefbehaviour
Closed

Fixed undefined behaviour in VariousWaves_Init.#191
friedrichatgc wants to merge 1 commit intoOpenFAST:devfrom
friedrichatgc:undefbehaviour

Conversation

@friedrichatgc
Copy link

InitOut%WaveDirArr(InitOut%NStepWave2) is not set in case of
multi-directional waves. This leads to undefined behaviour (read of
uninitialized value).

Set this value to 0 as workaround (this generates defined behaviour).
The correct fix is unclear: maybe InitOut%WaveDirArr(0) should be set
to 0 and the index K starting from 1 then???

InitOut%WaveDirArr(InitOut%NStepWave2) is not set in case of
multi-directional waves. This leads to undefined behaviour (read of
uninitialized value).

Set this value to 0 as workaround (this generates defined behaviour).
The correct fix is unclear: maybe InitOut%WaveDirArr(0) should be set
to 0 and the index K starting from 1 then???
@rafmudaf rafmudaf changed the base branch from master to dev November 1, 2018 19:15
@ebranlard
Copy link
Contributor

ebranlard commented Feb 7, 2019

I confirmed that is still the case with version 2.1.

The issue is that the last value of WaveDirArr is never set in the loop over WvSpreadFreqPerDir.

The value should not be set to zero but set to a random value of WvTheta.

I'll send another pull request to fix this. I've added an issue to reference this: #236

@ebranlard
Copy link
Contributor

I would cancel this pull request and merge #237 instead.

@rafmudaf rafmudaf self-assigned this Feb 21, 2019
@rafmudaf
Copy link
Collaborator

@friedrichatgc thanks for your suggestion. Pull request #237 fixed this issue.

@rafmudaf rafmudaf closed this Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants