User account creation filtered due to spam.
The store at the beginning of a catch block can use an alias set that is
allegedly disjoint from the one used to load that value. When scheduling,
this can cause the load to be moved before the store.
Created attachment 11730 [details]
This test case should go in testsuite/g++.dg/eh .
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
Though it is obviously wrong from the front-end:
register void * D.2002;
(int * * const &) &D.2002
(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. */
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,
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?
Created attachment 11732 [details]
I'm currently testing this patch.
Subject: Bug number PR 28139
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01295.html
The keyword description says that the "alias" keyword is specific to missed optimizations due to aliasing issues.
If that is true, than adding this keyword here was incorrect. If that isn't
true, then the keyword description should be corrected.
Date: Fri, 25 Aug 2006 16:03:00 -0400
From: Jason Merrill <firstname.lastname@example.org>
Subject: Re: RFA: Fix PR 28139
This is OK.
Subject: Bug 28139
Date: Tue Aug 29 14:34:36 2006
New Revision: 116561
* except.c (expand_start_catch_block): Use correct types for bitwise
* g++.dg/eh/alias1.C: New test.
Fixed on mainline; however, the problem was already present in 4.1, so we need to decide if we want the patch in the 4.1 branch.
Fixed so closing.