Skip to content

Fix incompatible sft pointer types in sf_ntrianglen_init - #331

Open
cplusv2023 wants to merge 1 commit into
ahay:masterfrom
cplusv2023:fix_sft
Open

Fix incompatible sft pointer types in sf_ntrianglen_init#331
cplusv2023 wants to merge 1 commit into
ahay:masterfrom
cplusv2023:fix_sft

Conversation

@cplusv2023

Copy link
Copy Markdown
Contributor

Problem

sf_ntrianglen_init() expects the shift argument to be float **sft, but several real-valued programs and intermediate functions under user/chenyk still declared and passed it as int **sft.

This caused build failures such as:

error: passing argument 5 of 'sf_ntrianglen_init' from incompatible pointer type
note: expected 'float **' but argument is of type 'int **'

Since GCC 14, incompatible pointer types are treated as errors by default. Although the diagnostic can be downgraded using -Wno-error=incompatible-pointer-types, doing so does not make the code valid: passing int ** where float ** is expected causes the underlying integer data to be accessed as floating-point data, resulting in undefined behavior.

Changes

  • Change sft from int ** to float ** throughout the affected real-valued call chains
  • Update the corresponding M*.c programs to allocate floating-point shift arrays
  • Preserve compatibility with existing integer shift# inputs by reading them into a temporary integer buffer and converting them to float
  • Allow floating-point shift# inputs to be read directly
  • Keep the complex-valued cntrianglen call chain unchanged

Affected call chains

  • sf_ntrianglen_init
  • divnn_init
  • divnn_sc_init2
  • dip3n_init
  • odipn_init
  • warpscann_init

The primary purpose of this change is to fix the incompatible pointer types in the real-valued non-stationary smoothing implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant