[cfe-dev] PR16833 - Analyzer hangs trying to analyze large case ranges

Zach Davis zdavkeos at gmail.com
Tue Aug 12 12:39:49 PDT 2014


All-

I was looking over 16833 and had a few questions.

The issue is the analyzer tries to concretize all the values in a case
statement with a range value:

    switch (a) {
        case 1 ... 0xfffff: // hang's trying each value in the range
           return 1;
        default:
           return 0;
    }

Is there any reason we can't symbolically evaluate 1 <= a <= 0xfffff,
rather than trying each 'a == v for v in 1..0xfffff'? I've attached a
patch that attempts to do this and it seems to work (it no longer
hangs anyway).  Is there a technical/historical reason for doing it
the current way?

The FIXME above the block mentions using '"ranges" for NonLVals'. I'm
not sure what this means, or if any work has been done toward this.
If not, would there be any value in pursing a patch like this in the
meantime to resolve the performance issue?

Thanks,
Zach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 16833_hang_on_large_case_range.patch
Type: text/x-patch
Size: 3796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140812/ad99913f/attachment.bin>


More information about the cfe-dev mailing list