This is the mail archive of the gcc@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: generic bug in fixed-point constant folding


Sean D'Epagnier wrote:
> 
> I think I found a generic problem for fixed point constant folding.
> 
> In fold-const.c:11872 gcc tries to apply:
>       /* Transform (x >> c) << c into x & (-1<<c), or transform (x <<
> c) >> c
>          into x & ((unsigned)-1 >> c) for unsigned types.  */
> 
> I attached a simple patch which fixes the problem by not applying this
> optimization to fixed point types.  I would like to have this
> optimization because it is possible.. but the problem is fixed-point
> types do not support bitwise operations like & | ^ ~.. so without
> supporting these somehow internally but not allowing the user to have
> them, this can't take place.
> 
> I am open to other suggestions.  For future reference should this be
> posted as a bug report?   It seems simple enough that it could be
> included right away.. but I feel like if it's a bug report no one will
> notice since fixed-point support is not widely used.
> 
> Sean
> 

  Thanks for finding this bug and fixing it!  I think you should send your
patch to gcc-patches@gcc.gnu.org, and check in this patch to mainline and 4.3
if possible.

Regards,
Chao-ying


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