Patch for gcc.dg/compare2.c "case 10"

Jeffrey A Law law@cygnus.com
Fri Aug 4 10:41:00 GMT 2000


  In message <20000601124759.A7977@wolery.cumb.org>you write:
  > This patch gets rid of the spurious signed/unsigned warning for
  > 
  >   unsigned > ({ signed; 23; });
  > 
  > The tree structure for the right-hand side looks like
  > 
  >    <bind_expr
  >       type <integer_type int>
  >       body <rtl_expr type <integer_type int>
  >         rtl 0 (insn) (insn) ...
  >         rtl 1 (const_int 23)
  >       >
  >       block <...>>
  > 
  > so we just have to teach tree_expr_nonnegative_p to look inside
  > BIND_EXPRs and RTL_EXPRs for nonnegative constants.  This is easy.  It
  > is not good enough to fix case 12,
  > 
  >   unsigned > ({ signed ? 12 : 24; });  /* simplified */
  > 
  > The RTL_EXPR for that one will do substantial work in the 'sequence'
  > slot and have a pseudo in the 'result' slot.  It is theoretically
  > possible to deduce the relevant property from the RTL in the sequence,
  > but it would be a huge amount of effort, no doubt better applied to
  > functions as trees.  I'm going to mark case 12 an expected failure.
  > 
  > I'm not 100% sure about the handling of CONST_DOUBLEs in
  > rtl_expr_nonnegative_p.  I moved the functions to fold-const.c because
  > tree.c doesn't include rtl.h.
  > 
  > Bootstrapped i386-linux.  There are a number of recent regressions in
  > libio and libstdc++ which I am 99% sure are not my fault.
  > 
  > zw
  > 
  > 	* tree.c (tree_expr_nonnegative_p): Move to...
  > 	* fold-const.c: ... here.  Also handle BIND_EXPR and RTL_EXPR.
  > 	(rtl_expr_nonnegative_p): New.
  > 	* tree.h: Add prototype for rtl_expr_nonnegative_p.
Basically OK, except the code to handle CONST_DOUBLEs in 
rtl_expr_nonnegative_p.

If you need to move it where you can get at CONST_DOUBLE_HIGH, please do
so.

jeff



More information about the Gcc-patches mailing list