This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR59586
- From: Mircea Namolaru <mircea dot namolaru at inria dot fr>
- To: Roman Gareev <gareevroman at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Tobias Grosser <tobias at grosser dot es>
- Date: Tue, 11 Mar 2014 22:24:09 +0100 (CET)
- Subject: Re: Fix PR59586
- Authentication-results: sourceware.org; auth=none
- References: <CABGF_gfVketbPXwghwmw=TNKxwvx5Spvg_WrjekEMEFpmaPZTA at mail dot gmail dot com>
Hi,
I think that NULL pointer checks should be added for all pointers
must_raw, may_raw etc, not only for the *_no_source ones.
This will make the function more robust and easier to maintain.
Indeed in the current code only the *_no_source pointers may be NULL, but
this may change in the future so you don't want to base the correctness of
the code on this assumption.
Mircea
----- Original Message -----
> From: "Roman Gareev" <gareevroman@gmail.com>
> To: gcc-patches@gcc.gnu.org
> Cc: "Tobias Grosser" <tobias@grosser.es>, "mircea namolaru" <mircea.namolaru@inria.fr>
> Sent: Monday, March 10, 2014 5:39:47 PM
> Subject: Fix PR59586
>
> This patch fixes PR59586.
> The segfault is caused by NULL arguments passed to compute_deps by
> loop_level_carries_dependences.
> This causes an assignment of NULL values to the no_source parameters
> of compute_deps.
> They are passed to subtract_commutative_associative_deps and dereferenced.
>
> However, this NULL arguments are appropriate for the algorithm used
> in loop_level_carries_dependences. It uses compute_deps
> for finding RAW, WAR and WAW dependences of all basic blocks
> in the body of the given loop. Subsequently, it tries to
> determine presence of these dependences at the given level.
> Therefore it maps the relation of the dependences to the relation
> of the corresponding time-stamps and intersects the result with
> the relation in which all the inputs before the DEPTH occur at the
> same time as the output, and the input at the DEPTH occurs before output.
> If the intersection is not empty, some dependences are carried
> by the DEPTH we currently check and the loop is consequently not parallel.
>
> This patch tries to avoid the problem by adding NULL checking of the
> no_source statements to
> subtract_commutative_associative_deps.
>
> Tested x86_64-unknown-linux-gnu, applying to 4.8.3 and trunk.
>