* Bruce Korb:

> I wrote a loop that figures out how many items are in a list,
> counts down from that count to -1, changes direction and counts
> up from 0 to the limit, a la:
>
>
>     inc  = -1;
>     int idx = 0;
>     while (opts->papzHomeList[idx+1] != NULL)
>         idx++;
>     for (;;) {
>         if (idx < 0) {  <<<=== line 1025
>             inc = 1;
>             idx = 0;
>         }
>         char const * path = opts->papzHomeList[ idx ];
>         if (path == NULL)
>             break;
>         idx += inc;
>         //  do a bunch of stuff
>     }
>
> ../../autoopts/configfile.c: In function 'intern_file_load':
> ../../autoopts/configfile.c:1025:12: error: assuming signed overflow does not 
> occur \
>     when simplifying conditional to constant [-Werror=strict-overflow]

I can't reproduce this.  Can you post a minimal example that actually
shows this warning?

> My guess is that some code somewhere presumes that "idx" never gets
> decremented.  Not true.

The warning can trigger after inlining and constant propogation,
somewhat obscuring its cause.  PR55616 is one such example.

Reply via email to