This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/63595] [5.0 Regression] Segmentation faults inside kernel


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63595

--- Comment #6 from Martin LiÅka <mliska at suse dot cz> ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63595
>
> --- Comment #5 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
> Created attachment 33796
>    --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33796&action=edit
> preprocessed source from 254.gap
>
> CPU2000 benchmark 254.gap started miscomparing with r216305 also. Attaching
> preprocessed source as another example that gets miscompiled. Compile options
> used 'gcc -m64 -O2 -mcpu=power7'. In this example, function 'FunOnRight' gets
> redirected to 'FunOnLeft' (after initial test where the two functions have
> differing error strings). But the last stmt in the functions which compute the
> return value are not equivalent and therefor shouldn't be commoned.
>
>  From list.i:
>
> FunOnRight()
>      ...
>      hdRes = ((*TabProd[(((long)(hdPnt) & 1) ? 1 :
> ((hdPnt)->type))][(((long)(hdElm) & 1) ? 1 :
> ((hdElm)->type))])((hdPnt),(hdElm)));
>
>
> FunOnLeft()
>      ...
>      hdRes = ((*TabProd[(((long)(hdElm) & 1) ? 1 :
> ((hdElm)->type))][(((long)(hdPnt) & 1) ? 1 :
> ((hdPnt)->type))])((hdElm),(hdPnt)));
>
>
> Note the swapping of 'hdPnt' and 'hdElm' references.
>

There's patch I've been testing:

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index d1238a4..7456fec 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -869,6 +869,12 @@ sem_function::compare_phi_node (basic_block bb1, 
basic_block bb2)
        phi1 = gsi_stmt (si1);
        phi2 = gsi_stmt (si2);

+      tree phi_result1 = gimple_phi_result (phi1);
+      tree phi_result2 = gimple_phi_result (phi2);
+
+      if (!m_checker->compare_operand (phi_result1, phi_result2))
+    return return_false_with_msg ("PHI results are different");
+
        size1 = gimple_phi_num_args (phi1);
        size2 = gimple_phi_num_args (phi2);


Martin

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