[Bug middle-end/90514] Issue about enum type in gcc tree

2019-05-19 Thread JunMa at linux dot alibaba.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90514

--- Comment #4 from JunMa  ---
(In reply to Andrew Pinski from comment #3)
> (In reply to JunMa from comment #2) 
> > I had got confused by the comments in vrp pass. the condition
> >   if ((kind != ENUM1) && (kind != ENUM2))
> > is not always false, and cannot be folded to if (0). 
> > Also the code deals with pr23046 is out of data, and should be removed.
> 
> That was C++ code rather than C code and C++ which has different rules than
> C (at least with -fstrict-enums).  The code is not out of date for gimple
> types.  Since the types in Gimple can have more well defined behaviors which
> are not exposed via C or C++ front-ends.  NOTE there could be an Ada code
> which hits the same failure (I don't know Ada that well but I do know the
> Ada front-end supports more features of the GCC middle-end than either of
> the C or C++ front-ends).

Since gimple folding has changed so much, we can easily support folding it in
match.pd rather than checking this in here.

[Bug middle-end/90514] Issue about enum type in gcc tree

2019-05-19 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90514

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #3 from Andrew Pinski  ---
(In reply to JunMa from comment #2) 
> I had got confused by the comments in vrp pass. the condition
>   if ((kind != ENUM1) && (kind != ENUM2))
> is not always false, and cannot be folded to if (0). 
> Also the code deals with pr23046 is out of data, and should be removed.

That was C++ code rather than C code and C++ which has different rules than C
(at least with -fstrict-enums).  The code is not out of date for gimple types. 
Since the types in Gimple can have more well defined behaviors which are not
exposed via C or C++ front-ends.  NOTE there could be an Ada code which hits
the same failure (I don't know Ada that well but I do know the Ada front-end
supports more features of the GCC middle-end than either of the C or C++
front-ends).

[Bug middle-end/90514] Issue about enum type in gcc tree

2019-05-17 Thread JunMa at linux dot alibaba.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90514

--- Comment #2 from JunMa  ---
(In reply to Andrew Pinski from comment #1)
> Are you saying the precision should be 1?  If so then no, that would be
> invalid as in C, enum have the full range of the underlying type and is well
> defined to have values of 3 or higher in the enum variable.

Thanks for explain. 

I had got confused by the comments in vrp pass. the condition
  if ((kind != ENUM1) && (kind != ENUM2))
is not always false, and cannot be folded to if (0). 
Also the code deals with pr23046 is out of data, and should be removed.

[Bug middle-end/90514] Issue about enum type in gcc tree

2019-05-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90514

--- Comment #1 from Andrew Pinski  ---
Are you saying the precision should be 1?  If so then no, that would be invalid
as in C, enum have the full range of the underlying type and is well defined to
have values of 3 or higher in the enum variable.