Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/cdhc: Fixed uninitialized variable warnings in Cdhc_dmax #3995

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

ShubhamDesai
Copy link
Contributor

This pull request addresses the following warning identified by clang.

Issue:
dmax.c:48:10: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
y[0] = dp_max;

Changes made:

The issue was fixed by initializing the variables dp, dp_max, dm, and dm_max to 0.0. This ensures that the variables have a defined value before they are used in the calculation. The updated part of the code is:

double dp = 0.0, dp_max = 0.0, dm = 0.0, dm_max = 0.0;

To maintain consistency across the code, variables other than dp_max are also initialized.

@github-actions github-actions bot added C Related code is in C libraries labels Jul 7, 2024
@ShubhamDesai ShubhamDesai changed the title Fixed uninitialized variable warning in dmax.c by initializing dp, dp_max, dm, and dm_max to 0.0 lib: Fixed uninitialized variable warning in dmax.c by initializing dp, dp_max, dm, and dm_max to 0.0 Jul 7, 2024
@echoix echoix merged commit ef69cb4 into OSGeo:main Jul 8, 2024
26 of 27 checks passed
@neteler neteler added this to the 8.5.0 milestone Jul 9, 2024
a0x8o pushed a commit to a0x8o/grass that referenced this pull request Jul 23, 2024
…p, dp_max, dm, and dm_max to 0.0 (OSGeo#3995)

Fixed uninitialized variable warning in dmax.c by initializing dp, dp_max, dm, and dm_max to 0.0.
@wenzeslaus wenzeslaus changed the title lib: Fixed uninitialized variable warning in dmax.c by initializing dp, dp_max, dm, and dm_max to 0.0 lib/cdhc: Fixed uninitialized variable warnings in Cdhc_dmax Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants