This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Partial fix for PR14016
On Friday 06 February 2004 03:17, Richard Henderson wrote:
> On Fri, Feb 06, 2004 at 12:36:40AM +0100, Steven Bosscher wrote:
> > if (TREE_CODE (t) == MODIFY_EXPR)
> > {
> > ! tree sub = TREE_OPERAND (t, 1);
> > ! if (TREE_CODE (sub) == CALL_EXPR)
> > ! t = sub;
> > ! else
> > ! {
> > ! if (flag_non_call_exceptions)
> > ! {
> > ! if (tree_could_trap_p (sub))
> > ! return true;
> > ! return tree_could_trap_p (TREE_OPERAND (t, 0));
> > ! }
> > ! return false;
> > ! }
> > }
> >
> > if (TREE_CODE (t) == CALL_EXPR)
> > return (call_expr_flags (t) & ECF_NOTHROW) == 0;
> >
> > ! return false;
> > }
> >
> > bool
> > --- 1703,1728 ----
> > {
> > if (!flag_exceptions)
> > return false;
> > +
> > + /* If T is a MODIFY_EXPR and non-call exceptions are possible, we
> > have + to look at both the rhs and lhs of the assignment to see if
> > it could + throw. */
> > if (TREE_CODE (t) == MODIFY_EXPR)
> > {
> > ! tree lhs = TREE_OPERAND (t, 0);
> > ! tree rhs = TREE_OPERAND (t, 1);
> > ! if (flag_non_call_exceptions
> > ! && (tree_could_trap_p (rhs) || tree_could_trap_p (lhs)))
> > ! return true;
> > ! if (TREE_CODE (rhs) == CALL_EXPR)
> > ! t = rhs;
> > }
> >
> > + /* For a call, only nothrow functions can never throw. */
> > if (TREE_CODE (t) == CALL_EXPR)
> > return (call_expr_flags (t) & ECF_NOTHROW) == 0;
>
> What exactly do you think you're changing here?
The idea is that you can pass just a gimple rhs to tree_could_throw_p.
Right now you can give it a MODIFY_EXPR or a CALL_EXPR but nothing else,
so I couldn't call it on from_p in gimlify_modify_expr because it would
miss all noncall exceptions.
> Anyway, you've broken non-local goto, which C does have.
> I don't think you can know about that at this point.
I have? How? AFAICT tree_could_trap_p returns false for a GOTO_EXPR
before and after the patch. I also didn't see any failures in the test
suite, are there no nonlocal goto test cases in it?
Gr.
Steven