Fix GCC 13.2.1 compilation with -Werror#197
Open
Silvanosky wants to merge 3 commits intomicmacIGN:masterfrom
Open
Fix GCC 13.2.1 compilation with -Werror#197Silvanosky wants to merge 3 commits intomicmacIGN:masterfrom
Silvanosky wants to merge 3 commits intomicmacIGN:masterfrom
Conversation
7bbfa88 to
9fc31f3
Compare
jmmuller
reviewed
Aug 17, 2023
|
|
||
| void incr_capa() | ||
| { | ||
| if (_capa == 0) |
Contributor
There was a problem hiding this comment.
Should be
if (_capa < 1)
_capa = 1;
in constructor?
Collaborator
Author
There was a problem hiding this comment.
It can be, I did this in case _capa=-1 means uninitialized where _capa = 0 is an error
| 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)); |
Contributor
There was a problem hiding this comment.
Why not declaring size here?
Collaborator
Author
There was a problem hiding this comment.
The value needs to be computed before the realloc to avoid use after free
Member
|
Je manque un peu de contexte, cela dit je vois pas cette ligne dans les ElFifo
De: "JM Muller" ***@***.***>
À: "micmacIGN/micmac" ***@***.***>
Cc: "Marc Pierrot-Deseilligny" ***@***.***>, "Review requested" ***@***.***>
Envoyé: Jeudi 17 Août 2023 15:01:42
Objet: Re: [micmacIGN/micmac] Fix GCC 12.1.0 compilation with -Werror (PR #197)
@jmmuller commented on this pull request.
In [ #197 (comment) | include/ext_stl/fifo.h ] :
@@ -197,6 +197,9 @@ template <class Type> class ElFifo
void incr_capa()
{
+ if (_capa == 0)
Should be
if (_capa < 1)
_capa = 1;
in constructor?
In [ #197 (comment) | src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.cpp ] :
@@ -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));
Why not declaring size here?
—
Reply to this email directly, [ #197 (review) | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AFROVJQIAXQPAVFIGPIDJD3XVYI3NANCNFSM5YNVEMPA | unsubscribe ] .
You are receiving this because your review was requested. Message ID: ***@***.***>
|
Contributor
|
Hello !
Charles a fait des corrections parce que son compilateur a un peu plus de warnings que nous.
Il a fait une pull request pour ces modifs :
https://github.com/micmacIGN/micmac/pull/197/files
Dans incr_capa() il a rajouté un test de _capa==0 et mise à 1 pour éviter les accidents. (Je ne sais pas quel message le compilateur lui a dit pour remarquer le problème).
Je propose juste de passer ce test dans le constructeur parce que autant régler le pb tout de suite ?
De: "pierrot deseilligny" ***@***.***>
À: "micmacIGN/micmac" ***@***.***>
Cc: "Jean-Michael Muller" ***@***.***>, "Mention" ***@***.***>
Envoyé: Jeudi 17 Août 2023 15:11:04
Objet: Re: [micmacIGN/micmac] Fix GCC 13.2.1 compilation with -Werror (PR #197)
Je manque un peu de contexte, cela dit je vois pas cette ligne dans les ElFifo
De: "JM Muller" ***@***.***>
À: "micmacIGN/micmac" ***@***.***>
Cc: "Marc Pierrot-Deseilligny" ***@***.***>, "Review requested" ***@***.***>
Envoyé: Jeudi 17 Août 2023 15:01:42
Objet: Re: [micmacIGN/micmac] Fix GCC 12.1.0 compilation with -Werror (PR #197)
@jmmuller commented on this pull request.
In [ #197 (comment) | include/ext_stl/fifo.h ] :
@@ -197,6 +197,9 @@ template <class Type> class ElFifo
void incr_capa()
{
+ if (_capa == 0)
Should be
if (_capa < 1)
_capa = 1;
in constructor?
In [ #197 (comment) | src/uti_phgrm/GraphCut/QPBO-v1.4/QPBO.cpp ] :
@@ -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));
Why not declaring size here?
—
Reply to this email directly, [ #197 (review) | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AFROVJQIAXQPAVFIGPIDJD3XVYI3NANCNFSM5YNVEMPA | unsubscribe ] .
You are receiving this because your review was requested. Message ID: ***@***.***>
—
Reply to this email directly, [ #197 (comment) | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AF3NYM4IRVNTY4K6H76YZMTXVYJ6RANCNFSM5YNVEMPA | unsubscribe ] .
You are receiving this because you were mentioned. Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.