[Bug c++/28139] alias information for EH is wrong

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jun 22 16:58:00 GMT 2006



------- Comment #4 from amylaar at gcc dot gnu dot org  2006-06-22 16:55 -------
(In reply to comment #2)
> Hmm, I just get an error on a 64bit target so the testcase is at least invalid
> for them:
> t.c:19: error: cast from 'int*' to 'int' loses precision
> 
You can write this as:
exit ((int)(long long) &i);
I have verified that this also reproduces the problem on sh-elf.

(In reply to comment #3)
> Though it is obviously wrong from the front-end:
> register void * D.2002;
> (int * * const &) &D.2002
> 

As far as I can tell, this code in cp/except.c:expand_start_catch_block:
  /* Otherwise the type uses a bitwise copy, and we don't have to worry
     about the value of std::uncaught_exception and therefore can do the
     copy with the return value of __cxa_end_catch instead.  */
  else
    {
      tree init = do_begin_catch ();
      exp = create_temporary_var (ptr_type_node);
      DECL_REGISTER (exp) = 1;
      cp_finish_decl (exp, init, /*init_const_expr=*/false,
                      NULL_TREE, LOOKUP_ONLYCONVERTING);
      initialize_handler_parm (decl, exp);

is wrong.  exp has the wrong type, hence the store emitted by cp_finish_decl
will end up with the wrong alias set.
I'm not sure yet what the right type is, though. would that be the type of decl
for pointers, and a pointer to that type for non-pointers?  Or a reference?


-- 


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



More information about the Gcc-bugs mailing list