This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH COMMITTED: Don't break tests for enum in range


> > We have, see above, you just have to force high to NULL too.
>
> Sounds reasonable.  I certainly have no objection to that patch if it
> handles the new test case as expected.

Unfortunately it doesn't.  For

 <le_expr 0x2a95897640
    type <boolean_type 0x2a958a48f0 bool public unsigned QI
        size <integer_cst 0x2a958917e0 constant invariant 8>
        unit size <integer_cst 0x2a95891810 constant invariant 1>
        align 8 symtab 0 alias set -1 precision 1 min <integer_cst 
0x2a95891fc00> max <integer_cst 0x2a958af030 1>>

    arg 0 <nop_expr 0x2a95a27000
        type <integer_type 0x2a958a44d0 int public SI
            size <integer_cst 0x2a95891bd0 constant invariant 32>
            unit size <integer_cst 0x2a958916f0 constant invariant 4>
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0x2a95891b40 -2147483648> max <integer_cst 0x2a95891b70 2147483647>
            pointer_to_this <pointer_type 0x2a958b6790>>

        arg 0 <parm_decl 0x2a95a260a0 v type <enumeral_type 0x2a95a1d420 E>
            used unsigned SI file enum1.C line 8 size <integer_cst 
0x2a95891bd032> unit size <integer_cst 0x2a958916f0 4>
            align 32 context <function_decl 0x2a95a1e1c0 valid> initial 
<enumeral_type 0x2a95a1d420 E> arg-type <enumeral_type 0x2a95a1d420 E>>>
    arg 1 <integer_cst 0x2a958af8a0 type <integer_type 0x2a958a44d0 int> 
constant invariant 1>>

make_range would return the full range (+[-,-]), which is IMHO correct.

So the final range would be (+[1, 2147483647])

bool valid(E) (v)
{
  int D.2340;
  int v.0;

  v.0 = (int) v;
  D.2340 = v.0 > 0;
  return D.2340;
}

and we would of course return 1 for valid(E(2)).  


Clearly the only way to make this kind of questionable testcases pass is to 
trim the teeth of the optimizers, here the constant folder, probably VRP for 
some slight variations.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]