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: ipa-pure-const fixes


> For GCC the main stopper is checking code.  Our diagnostic is annotated
> noreturn, but not pure that leads ipa-pure-const to mark as nothing every
> function calling abort.  ipa-pure-const already knows that noreturn nothrow
> calls don't need to be considered this way.  However this is not good
> enough, since we do not mark functions nothrow but since we do not compile
> with flag_exceptions, we are safe to ignore this.
>
> This patch solves this problem by adding cgraph_node_cannot_return and
> cgraph_edge_cannot_lead_to_return.  In near future I will make
> ipa-reference to use them too (I am waiting with changes I cummulated to
> this file for the leaf attribute patch) and also add cgraph walking at
> cgraph construction time to figure out what basic blocks can not lead to
> return/external throw.

The patch causes the Ada compiler to miscompile itself in optimized bootstrap 
(i.e. -gnatpg -gnatn instead of the default -gnatpg -gnata).

In sem_prag.adb, Check_First_Subtype is marked as "locally pure" by the pass 
so calls to it don't have side-effects and are optimized out, which is wrong 
since the function calls Error_Pragma_Arg.  Error_Pragma_Arg is declared 
noreturn but it definitely has side-effects since it stops the compiler!

-- 
Eric Botcazou


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