Skip to content

Fix gcc-14 Wcalloc-transposed-args warnings #13818

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

Closed
wants to merge 2 commits into from

Conversation

crrodriguez
Copy link
Contributor

gcc-14 and later warns of inverted arguments in calloc or calloc-like alloc_size annotated functions.

gcc-14 and later warns of inverted arguments in calloc or
calloc-like __alloc_size__ annotated functions.
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Thanks for fixing this.

@dstogov
Copy link
Member

dstogov commented Mar 28, 2024

Can you please target the PR to PHP-8.3.

@crrodriguez
Copy link
Contributor Author

Can you please target the PR to PHP-8.3.

Mine to share why ? despite the warnings the resulting allocations will have the same size..this is just to shut up the compiler..all of this assuming all the wrappers used by ecalloc multiply both values..(which seems to be the case on a quick glance)

@dstogov
Copy link
Member

dstogov commented Apr 1, 2024

Warnings tells what something is wrong. Actually, they caught bugs that might cause different alignment of allocated memory.

@crrodriguez crrodriguez changed the base branch from master to PHP-8.3 April 1, 2024 17:57
@crrodriguez crrodriguez changed the base branch from PHP-8.3 to master April 1, 2024 18:00
@nielsdos
Copy link
Member

nielsdos commented Apr 1, 2024

@crrodriguez Looks like something went wrong when changing branches, you should typically rebase instead of merge to fix up your branch after changing the base branch.
I can also just cherry-pick your fix into 8.3 for you, let me know if you'd like to fix it yourself or if I should cherry-pick.

@crrodriguez
Copy link
Contributor Author

@crrodriguez Looks like something went wrong when changing branches, you should typically rebase instead of merge to fix up your branch after changing the base branch. I can also just cherry-pick your fix into 8.3 for you, let me know if you'd like to fix it yourself or if I should cherry-pick.

Yes, please if you can.

@nielsdos nielsdos closed this in 18d70db Apr 1, 2024
@nielsdos
Copy link
Member

nielsdos commented Apr 1, 2024

Merged manually, thanks for the patch!

@crrodriguez crrodriguez deleted the calloc-transposed-args branch April 1, 2024 19:26
MaxKellermann pushed a commit to CM4all/php-src that referenced this pull request Oct 15, 2024
gcc-14 and later warns of inverted arguments in calloc or
calloc-like __alloc_size__ annotated functions.

Closes phpGH-13818.
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.

5 participants