------- Comment #6 from manu at gcc dot gnu dot org  2008-02-15 16:34 -------
Some more findings:

build_binary_op receives two parameters of type int: '(int)x' and '0x7fff'
then it performs the shorten magic that seems right and produces:

<bit_and_expr 
   type <integer_type short int 
    arg 0 <parm_decl x type <integer_type short int>
    arg 1 <integer_cst type <integer_type short int> constant invariant 32767>>

which looks good. But just before returning, it converts that to 'int', what
results in:

<bit_and_expr 
    type <integer_type int
  arg 0 <nop_expr type <integer_type int>
        arg 0 <parm_decl x type <integer_type short int>>
    arg 1 <integer_cst type <integer_type int>>

which causes problems later. If instead it returned:

<nop_expr type <integer_type int>
  <bit_and_expr 
     type <integer_type short int 
      arg 0 <parm_decl x type <integer_type short int>
      arg 1 <integer_cst type <integer_type short int> constant invariant>>

No warning would be generated!

Why bother with the shorten magic if convert is going to override it? Where it
is overriding it?

The current code converts the constant back and forth between short int and int
at least 3 times.

Any ideas on how to stop this madness?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34389

Reply via email to