This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix bogus 'function does return' warning


On Fri, Oct 16, 2009 at 12:44 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Thus the real reason for the warning is the return in
>>
>> ? ? ? ? if ((integer) R6b == (integer) R5b &&
>> VIEW_CONVERT_EXPR<character[1:1]>(*R3b.P_ARRAY) == "$")
>> ? ? ? ? ? {
>> ? ? ? ? ? ? .gnat_rcheck_20 ("noreturn1.adb", 9);
>> ? ? ? ? ? }
>> ? ? ? ? else
>> ? ? ? ? ? {
>> ? ? ? ? ? ? .gnat_rcheck_04 ("noreturn1.adb", 11);
>> ? ? ? ? ? }
>> ? ? ? ? return;
>>
>> or that .gnat_rcheck_* can appearantly throw (or instead that
>> EH lowering adds EH edges to the finally block even though
>> that the functions cannot return).
>>
>> So, can they throw or is EH lowering at fault here?
>
> Yes, they can throw, but that's not a normal return. ?And EH lowering must add
> the edges because "lower" has introduced goto <D.2151>:
>
> ? ? ?D.2142 = &"p.adb"[0];
> ? ? ?.gnat_rcheck_20 (D.2142, 7);
> ? ? ?<D.2137>:
> ? ? ?D.2143 = &"p.adb"[0];
> ? ? ?.gnat_rcheck_04 (D.2143, 9);

(X)

> ? ? ?goto <D.2151>;
> ? ?}
> ?finally
> ? ?{
> ? ? ?p.error (); [static-chain: &FRAME.8]
> ? ?}
> ?<D.2151>:
> ?return;
>
> I think the problem is this return -> goto transformation in "lower".

But EH lowering must still go through finally even if the return
remains, no?  So it indeed is the problem that nothing in EH
lowering sees that we cannot arrive at (X) but we only have
EH edges reaching the finally.

So the question is how does EH lowering see that for

      .gnat_rcheck_04 (D.2175, 11);
    }
  finally
    {
      noreturn1.error (); [static-chain: &FRAME.8]
    }

we can't enter the finally block through a regular edge and
whether we can extend that to also grok

      .gnat_rcheck_04 (D.2175, 11);
      goto <D.2183>;
    }
  finally
    {
      noreturn1.error (); [static-chain: &FRAME.8]
    }

the same...

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]