https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79647
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |INVALID Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- I can reproduce the warning. The VRP dump shows the following, indicating the warning is correctly interpreting the range information passed to it. _2724: [18446744071562067968, +INF] _1184: [18446742819579101184, 18446744073709551032] ... speed_main (int argc, char * * argv) ... long unsigned int _2724; long unsigned int _1184; ... <bb 84> [0.06%]: if (async_jobs_550 != 0) goto <bb 567>; [25.00%] ... <bb 567> [0.02%]: loopargs_len.29_1198 = (unsigned int) async_jobs_550; _1196 = loopargs_len.29_1198 * 584; _2726 = (int) _1196; loopargs_1193 = app_malloc (_2726, "array of loopargs"); _2724 = (long unsigned int) async_jobs_550; _1184 = _2724 * 584; memset (loopargs_1193, 0, _1184); The call to memset above is introduced by jump threading from this one: memset(loopargs, 0, loopargs_len * sizeof(loopargs_t)); for negative values of async_jobs (its type is int and its value is returned from atoi()). I think the warning is justified (if not exactly clear(*)) and indicative of a possible bug in the code. To avoid the warning, prevent negative async_jobs values from reaching the memset, e.g., like so: @@ -19021,6 +19021,13 @@ case OPT_ASYNCJOBS: async_jobs = atoi(opt_arg()); + if (async_jobs < 0) { + BIO_printf(bio_err, + "%s: async_jobs must be non-negative\n", + prog); + goto opterr; + } + if (!ASYNC_is_capable()) { BIO_printf(bio_err, "%s: async_jobs specified but async not supported\n", I'm resolving this report as invalid on that basis. [*] The warning is unfortunately missing the inlining context which can make some its instances hard to debug. A patch with a fix for that was submitted last month but deferred until GCC 8 (https://gcc.gnu.org/ml/gcc-patches/2017-01/msg01994.html).