Skip to content

Commit 8beff14

Browse files
committed
Merge remote-tracking branch 'origin/v9-minor'
2 parents 69956aa + f8960b9 commit 8beff14

File tree

10 files changed

+42
-23
lines changed

10 files changed

+42
-23
lines changed

src/scip/cons_nonlinear.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8718,6 +8718,7 @@ SCIP_RETCODE bilinTermAddAuxExpr(
87188718
}
87198719
else
87208720
{
8721+
assert(term->aux.exprs != NULL);
87218722
term->aux.exprs[pos]->underestimate |= auxexpr->underestimate;
87228723
term->aux.exprs[pos]->overestimate |= auxexpr->overestimate;
87238724
}

src/scip/heur.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ SCIP_RETCODE SCIPvariablegraphBreadthFirst(
17361736
if( vargraph == NULL )
17371737
{
17381738
SCIP_CALL( SCIPvariableGraphCreate(scip, &vargraph, FALSE, 1.0, NULL) );
1739+
assert(vargraph != NULL);
17391740
localvargraph = TRUE;
17401741
}
17411742
else

src/scip/heur_padm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,8 @@ static SCIP_DECL_HEUREXEC(heurExecPADM)
12681268
SCIP_VAR* var;
12691269
const char* vname;
12701270

1271+
assert(linkvartoblocks[i].indexes != NULL);
1272+
12711273
vname = SCIPvarGetName(linkvars[i]);
12721274
k = 0;
12731275
for( b = 0; b < problem->nblocks; b++ )

src/scip/heur_twoopt.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ SCIP_RETCODE innerPresolve(
674674
assert(vars != NULL);
675675
assert(nvars >= 2);
676676
assert(nblocks != NULL);
677+
assert(maxblocksize != NULL);
677678
assert(nblockvars != NULL);
678679
assert(blockstart != NULL);
679680
assert(blockend != NULL);
@@ -691,6 +692,7 @@ SCIP_RETCODE innerPresolve(
691692
*/
692693
startindex = 0;
693694
*nblocks = 0;
695+
*maxblocksize = 0;
694696
*nblockvars = 0;
695697

696698
SCIP_CALL( SCIPallocBlockMemoryArray(scip, blockstart, nvars/2) );
@@ -762,9 +764,9 @@ SCIP_RETCODE presolveTwoOpt(
762764
int nintvars;
763765
int nvars;
764766
SCIP_VAR** vars;
765-
int nbinblockvars = 0;
767+
int nbinblockvars;
766768
int nintblockvars;
767-
int maxbinblocksize = 0;
769+
int maxbinblocksize;
768770
int maxintblocksize;
769771

770772
assert(scip != NULL);
@@ -777,27 +779,31 @@ SCIP_RETCODE presolveTwoOpt(
777779
/* get necessary variable information, i.e. number of binary and integer variables */
778780
SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, NULL, NULL) );
779781

782+
#ifdef SCIP_STATISTIC
783+
/* update statistics */
784+
heurdata->ntotalbinvars += nbinvars;
785+
#endif
786+
780787
/* if number of binary problem variables exceeds 2, they are subject to 2-optimization algorithm, hence heuristic
781788
* calls innerPresolve method to detect necessary structures. */
782789
if( nbinvars >= 2 )
783790
{
784791
SCIP_CALL( innerPresolve(scip, vars, &(heurdata->binvars), nbinvars, &(heurdata->nbinblocks), &maxbinblocksize,
785792
&nbinblockvars, &(heurdata->binblockstart), &(heurdata->binblockend), heur, heurdata) );
786-
}
787-
788-
heurdata->nbinvars = nbinvars;
789-
heurdata->execute = nbinvars > 1 && heurdata->nbinblocks > 0;
790793

791794
#ifdef SCIP_STATISTIC
792-
/* update statistics */
793-
heurdata->binnblocks += (heurdata->nbinblocks);
794-
heurdata->binnblockvars += nbinblockvars;
795-
heurdata->ntotalbinvars += nbinvars;
796-
heurdata->maxbinblocksize = MAX(maxbinblocksize, heurdata->maxbinblocksize);
795+
/* update statistics */
796+
heurdata->binnblocks += heurdata->nbinblocks;
797+
heurdata->binnblockvars += nbinblockvars;
798+
heurdata->maxbinblocksize = MAX(maxbinblocksize, heurdata->maxbinblocksize);
797799

798-
SCIPstatisticMessage(" Twoopt BINARY presolving finished with <%d> blocks, <%d> block variables \n",
799-
heurdata->nbinblocks, nbinblockvars);
800+
SCIPstatisticMessage(" Twoopt BINARY presolving finished with <%d> blocks, <%d> block variables \n",
801+
heurdata->nbinblocks, nbinblockvars);
800802
#endif
803+
}
804+
805+
heurdata->nbinvars = nbinvars;
806+
heurdata->execute = nbinvars > 1 && heurdata->nbinblocks > 0;
801807

802808
if( heurdata->intopt && nintvars > 1 )
803809
{

src/scip/heuristics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ SCIP_RETCODE SCIPperformGenericDivingAlgorithm(
568568
{
569569
SCIP_VAR* bdchgvar;
570570
SCIP_Real bdchgvalue;
571-
SCIP_Longint localdomreds;
571+
SCIP_Longint localdomreds = 0;
572572
SCIP_BRANCHDIR bdchgdir;
573573
int nbdchanges;
574574

@@ -746,7 +746,7 @@ SCIP_RETCODE SCIPperformGenericDivingAlgorithm(
746746
while( backtrack );
747747

748748
/* we add the domain reductions from the last evaluated node */
749-
domreds += localdomreds; /*lint !e771 lint thinks localdomreds has not been initialized */
749+
domreds += localdomreds;
750750

751751
/* store candidate for pseudo cost update and choose next candidate only if no cutoff was detected */
752752
if( ! cutoff )

src/scip/nlhdlr_perspective.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ SCIP_DECL_NLHDLRENFO(nlhdlrEnfoPerspective)
17121712
if( doprobingind )
17131713
{
17141714
SCIP_Bool propagate;
1715-
SCIP_Bool cutoff_probing;
1715+
SCIP_Bool cutoff_probing = FALSE;
17161716
SCIP_Bool cutoff;
17171717
SCIP_Bool fixed;
17181718

src/scip/reader_fzn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,9 +1536,9 @@ SCIP_RETCODE parseOutputDimensioninfo(
15361536
DIMENSIONS** info /**< pointer to store the output dimension information if one */
15371537
)
15381538
{
1539-
FZNNUMBERTYPE type;
1540-
SCIP_Real lb;
1541-
SCIP_Real ub;
1539+
FZNNUMBERTYPE type = FZN_INT; /* init for scan-build */
1540+
SCIP_Real lb = SCIP_INVALID; /* init for scan-build */
1541+
SCIP_Real ub = SCIP_INVALID; /* init for scan-build */
15421542
int nelements;
15431543
int size;
15441544

src/scip/reader_osil.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,7 @@ SCIP_DECL_READERREAD(readerReadOsil)
24802480
xmlFreeNode(start);
24812481

24822482
/* free memory for constraint information (position nconss belongs to the nonlinear objective function) */
2483+
assert(termssize != NULL);
24832484
for( c = nconss; c >= 0; --c )
24842485
{
24852486
/* free nonlinear parts */

src/scip/reader_zpl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ extern "C" {
9292
}
9393
#endif
9494

95+
/* disable warning that our callbacks, like xlp_addvar, may return NULL if there was an error earlier,
96+
* even though they were declared __attribute__((__nonnull__))
97+
*/
98+
#if defined(__clang__)
99+
#pragma clang diagnostic ignored "-Wnonnull"
100+
#endif
101+
95102
#define READER_NAME "zplreader"
96103
#define READER_DESC "file reader for ZIMPL model files"
97104
#define READER_EXTENSION "zpl"

src/scip/scip_var.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,16 +1170,17 @@ void SCIPfreeParseVarsPolynomialData(
11701170
assert(monomialexps != NULL);
11711171
assert(monomialcoefs != NULL);
11721172
assert(monomialnvars != NULL);
1173-
assert((*monomialvars != NULL) == (nmonomials > 0));
1174-
assert((*monomialexps != NULL) == (nmonomials > 0));
1175-
assert((*monomialcoefs != NULL) == (nmonomials > 0));
1176-
assert((*monomialnvars != NULL) == (nmonomials > 0));
11771173

11781174
SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPfreeParseVarsPolynomialData", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
11791175

11801176
if( nmonomials == 0 )
11811177
return;
11821178

1179+
assert(*monomialvars != NULL);
1180+
assert(*monomialexps != NULL);
1181+
assert(*monomialcoefs != NULL);
1182+
assert(*monomialnvars != NULL);
1183+
11831184
for( i = nmonomials - 1; i >= 0; --i )
11841185
{
11851186
SCIPfreeBlockMemoryArrayNull(scip, &(*monomialexps)[i], (*monomialnvars)[i]);

0 commit comments

Comments
 (0)