From 3e0d41233540bcc91488240f001059f3a717d732 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Sat, 18 Nov 2023 13:28:37 +0100 Subject: [PATCH 1/3] disable yet another MSVC warning - std::pair() is called with arguments of type size_t --- src/symmetry/compute_symmetry_sassy.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/symmetry/compute_symmetry_sassy.cpp b/src/symmetry/compute_symmetry_sassy.cpp index 83dbf01e6b..dd3e94b42d 100644 --- a/src/symmetry/compute_symmetry_sassy.cpp +++ b/src/symmetry/compute_symmetry_sassy.cpp @@ -46,6 +46,7 @@ #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable: 4189) // local variable is initialized but not referenced +# pragma warning(disable: 4267) // conversion of size_t to int (at sassy/preprocessor.h:2897) # pragma warning(disable: 4388) // compare signed and unsigned expression # pragma warning(disable: 4456) // shadowed variable # pragma warning(disable: 4430) // missing type specifier From fee4ab29745731d088706eba4aff18988e62a67e Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Sat, 18 Nov 2023 13:38:53 +0100 Subject: [PATCH 2/3] intermediate cast to size_t instead of long for convert int->void* - to fix MSVC warning C4312: 'type cast': conversion from 'long' to 'void *' of greater size --- src/scip/prop_symmetry.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/scip/prop_symmetry.c b/src/scip/prop_symmetry.c index c490dce450..77c87b320b 100644 --- a/src/scip/prop_symmetry.c +++ b/src/scip/prop_symmetry.c @@ -3957,8 +3957,8 @@ SCIP_RETCODE addWeakSBCsSubgroup( { /* add element from lexorder to hashmap. * Use insert, as duplicate entries in lexorder is not permitted. */ - assert( ! SCIPhashmapExists(varsinlexorder, (void*) (long) (*lexorder)[k]) ); /* Use int as pointer */ - SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (long) (*lexorder)[k], k) ); + assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) (*lexorder)[k]) ); /* Use int as pointer */ + SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (size_t) (*lexorder)[k], k) ); } } @@ -3987,7 +3987,7 @@ SCIP_RETCODE addWeakSBCsSubgroup( /* If varidx is in lexorder, then it must be the first entry of lexorder. */ if ( varsinlexorder != NULL - && SCIPhashmapExists(varsinlexorder, (void*) (long) varidx) + && SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx) && lexorder != NULL && *lexorder != NULL && *maxnvarsorder > 0 && *nvarsorder > 0 && (*lexorder)[0] != varidx ) continue; @@ -4097,13 +4097,13 @@ SCIP_RETCODE addWeakSBCsSubgroup( if ( varidx == (*lexorder)[0] ) { /* lexorder is already ok!! */ - assert( SCIPhashmapExists(varsinlexorder, (void*) (long) varidx) ); + assert( SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx) ); } else { /* Then varidx must not be in the lexorder, * We must add it at the front of the array, and maintain the current order. */ - assert( ! SCIPhashmapExists(varsinlexorder, (void*) (long) varidx) ); + assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) varidx) ); ++(*maxnvarsorder); ++(*nvarsorder); From 08ddf676cf029f0ce31e77bd77c4e20affcaa896 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Mon, 20 Nov 2023 09:49:00 +0100 Subject: [PATCH 3/3] assert that indices to be cast to size_t are nonnegative --- src/scip/prop_symmetry.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scip/prop_symmetry.c b/src/scip/prop_symmetry.c index 77c87b320b..b28b3bc891 100644 --- a/src/scip/prop_symmetry.c +++ b/src/scip/prop_symmetry.c @@ -3957,6 +3957,7 @@ SCIP_RETCODE addWeakSBCsSubgroup( { /* add element from lexorder to hashmap. * Use insert, as duplicate entries in lexorder is not permitted. */ + assert((*lexorder)[k] >= 0); assert( ! SCIPhashmapExists(varsinlexorder, (void*) (size_t) (*lexorder)[k]) ); /* Use int as pointer */ SCIP_CALL( SCIPhashmapInsertInt(varsinlexorder, (void*) (size_t) (*lexorder)[k], k) ); } @@ -3979,6 +3980,7 @@ SCIP_RETCODE addWeakSBCsSubgroup( graphcomp = chosencomppercolor[j]; graphcompsize = graphcompbegins[graphcomp+1] - graphcompbegins[graphcomp]; varidx = firstvaridxpercolor[j]; + assert(varidx >= 0); /* if the first variable was already contained in another orbit or if there are no variables left anyway, skip the * component */ @@ -4077,6 +4079,7 @@ SCIP_RETCODE addWeakSBCsSubgroup( int varidx; varidx = orbit[activeorb][0]; + assert(varidx >= 0); if ( *maxnvarsorder == 0 ) {