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

Fix GCC 13.2.1 compilation with -Werror #197

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Silvanosky
Copy link
Collaborator

Mostly "maybe uninitialized" variable making the compilator not happy and use of pointer arithmetic with freed pointer which trigger compilation warning/error.

Need to check if graph cut reallocation code still used. If yes need to insure that the old freed pointer not used to suppress the compilation error.

Maybe others compiler will trigger other errors.

@@ -197,6 +197,9 @@ template <class Type> class ElFifo

void incr_capa()
{
if (_capa == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be

        if (_capa < 1)
            _capa = 1;

in constructor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be, I did this in case _capa=-1 means uninitialized where _capa = 0 is an error

@@ -202,7 +202,7 @@ template <typename T>
node_max[1] = nodes[1] + node_num_max;
if (stage)
{
memmove(nodes[1], (char*)nodes[0] + ((char*)nodes_old[1] - (char*)nodes_old[0]), node_num*sizeof(Node));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not declaring size here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The value needs to be computed before the realloc to avoid use after free

@Silvanosky Silvanosky changed the title Fix GCC 12.1.0 compilation with -Werror Fix GCC 13.2.1 compilation with -Werror Aug 17, 2023
@deseilligny
Copy link
Member

deseilligny commented Aug 17, 2023 via email

@jmmuller
Copy link
Contributor

jmmuller commented Aug 17, 2023 via email

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.

3 participants