[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2023-05-03 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #67 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:0200ac49e6281fd86ad391b539a4f564ca44e397

commit r10-11364-g0200ac49e6281fd86ad391b539a4f564ca44e397
Author: Andrew Pinski 
Date:   Thu Feb 9 16:03:54 2023 +0100

match.pd: When simplifying BFR of an insert, require a mode precision
integral type [PR108688]

The same problem as PR 88739 has crept in but
this time in match.pd when simplifying bit_field_ref of
an bit_insert. That is we are generating a BIT_FIELD_REF
of a non-mode-precision integral type.

PR tree-optimization/108688
* match.pd (bit_field_ref [bit_insert]): Avoid generating
BIT_FIELD_REFs of non-mode-precision integral operands.

* gcc.c-torture/compile/pr108688-1.c: New test.

(cherry picked from commit 44f308e59bfa0f93ae05b17e257d8563c12399fd)

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2023-05-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #66 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:d87adfe1a6455025eb3ae787a6da245a62cdb446

commit r11-10710-gd87adfe1a6455025eb3ae787a6da245a62cdb446
Author: Andrew Pinski 
Date:   Thu Feb 9 16:03:54 2023 +0100

match.pd: When simplifying BFR of an insert, require a mode precision
integral type [PR108688]

The same problem as PR 88739 has crept in but
this time in match.pd when simplifying bit_field_ref of
an bit_insert. That is we are generating a BIT_FIELD_REF
of a non-mode-precision integral type.

PR tree-optimization/108688
* match.pd (bit_field_ref [bit_insert]): Avoid generating
BIT_FIELD_REFs of non-mode-precision integral operands.

* gcc.c-torture/compile/pr108688-1.c: New test.

(cherry picked from commit 44f308e59bfa0f93ae05b17e257d8563c12399fd)

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2023-02-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #65 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:a5453c659bce698d80f5aebdab5ab0eba39b1ed6

commit r12-9153-ga5453c659bce698d80f5aebdab5ab0eba39b1ed6
Author: Andrew Pinski 
Date:   Thu Feb 9 16:03:54 2023 +0100

match.pd: When simplifying BFR of an insert, require a mode precision
integral type [PR108688]

The same problem as PR 88739 has crept in but
this time in match.pd when simplifying bit_field_ref of
an bit_insert. That is we are generating a BIT_FIELD_REF
of a non-mode-precision integral type.

PR tree-optimization/108688
* match.pd (bit_field_ref [bit_insert]): Avoid generating
BIT_FIELD_REFs of non-mode-precision integral operands.

* gcc.c-torture/compile/pr108688-1.c: New test.

(cherry picked from commit 44f308e59bfa0f93ae05b17e257d8563c12399fd)

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2023-02-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #64 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:44f308e59bfa0f93ae05b17e257d8563c12399fd

commit r13-5757-g44f308e59bfa0f93ae05b17e257d8563c12399fd
Author: Andrew Pinski 
Date:   Thu Feb 9 16:03:54 2023 +0100

match.pd: When simplifying BFR of an insert, require a mode precision
integral type [PR108688]

The same problem as PR 88739 has crept in but
this time in match.pd when simplifying bit_field_ref of
an bit_insert. That is we are generating a BIT_FIELD_REF
of a non-mode-precision integral type.

PR tree-optimization/108688
* match.pd (bit_field_ref [bit_insert]): Avoid generating
BIT_FIELD_REFs of non-mode-precision integral operands.

* gcc.c-torture/compile/pr108688-1.c: New test.

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-12-16 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #63 from Andrew Pinski  ---
Note match.pd has a similar bug.  Here is the patch which fixes it:
diff --git a/gcc/match.pd b/gcc/match.pd
index 92b93b0..8607abe 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -5676,16 +5676,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   isize = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (@1)));
   }
   (switch
-   (if (wi::leu_p (wi::to_wide (@ipos), wi::to_wide (@rpos))
+   (if ((!INTEGRAL_TYPE_P (TREE_TYPE (@1)) || type_has_mode_precision_p
(TREE_TYPE (@1)))
+&& wi::leu_p (wi::to_wide (@ipos), wi::to_wide (@rpos))
&& wi::leu_p (wi::to_wide (@rpos) + wi::to_wide (@rsize),
  wi::to_wide (@ipos) + isize))
 (BIT_FIELD_REF @1 @rsize { wide_int_to_tree (bitsizetype,
  wi::to_wide (@rpos)
 - wi::to_wide (@ipos)); }))
-   (if (wi::geu_p (wi::to_wide (@ipos),
-  wi::to_wide (@rpos) + wi::to_wide (@rsize))
-   || wi::geu_p (wi::to_wide (@rpos),
- wi::to_wide (@ipos) + isize))
+   (if ((!INTEGRAL_TYPE_P (TREE_TYPE (@0)) || type_has_mode_precision_p
(TREE_TYPE (@0)))
+ && (wi::geu_p (wi::to_wide (@ipos),
+   wi::to_wide (@rpos) + wi::to_wide (@rsize))
+|| wi::geu_p (wi::to_wide (@rpos),
+  wi::to_wide (@ipos) + isize)))
 (BIT_FIELD_REF @0 @rsize @rpos)

 (if (canonicalize_math_after_vectorization_p ())

- CUT 
The second part should not be needed as the first operand to BIT_INSERT_EXPR
should always be type_has_mode_precision_p; though I have not looked to make
sure that is the case.

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-03-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||7.4.1
 Resolution|--- |FIXED
  Known to fail||7.4.0

--- Comment #62 from Richard Biener  ---
Fixed.

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-03-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #61 from Richard Biener  ---
Author: rguenth
Date: Tue Mar 26 13:18:23 2019
New Revision: 269942

URL: https://gcc.gnu.org/viewcvs?rev=269942&root=gcc&view=rev
Log:
2019-02-26  Richard Biener  

Backport from mainline
2019-02-12  Richard Biener  

PR tree-optimization/89253
* tree-ssa-loop-split.c (tree_ssa_split_loops): Check we can
duplicate the loop.

* gfortran.dg/pr89253.f: New testcase.

2019-02-08  Richard Biener  

PR middle-end/89223
* tree-data-ref.c (initialize_matrix_A): Fail if constant
doesn't fit in HWI.
(analyze_subscript_affine_affine): Handle failure from
initialize_matrix_A.

* gcc.dg/torture/pr89223.c: New testcase.

2019-01-28  Richard Biener  

PR tree-optimization/88739
* tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid generating
BIT_FIELD_REFs of non-mode-precision integral operands.

* gcc.c-torture/execute/pr88739.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.c-torture/execute/pr88739.c
branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr89223.c
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr89253.f
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/tree-data-ref.c
branches/gcc-7-branch/gcc/tree-ssa-loop-split.c
branches/gcc-7-branch/gcc/tree-ssa-sccvn.c

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-03-26 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #60 from rguenther at suse dot de  ---
On Tue, 26 Mar 2019, dongjianqiang2 at huawei dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739
> 
> --- Comment #59 from John Dong  ---
> (In reply to John Dong from comment #58)
> > Created attachment 46022 [details]
> > fix the union bug on 7.3.0
> 
> hi, I tried to fix the bug when expanding. is it OK?

No, the fix is going to be backported soon.

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-03-26 Thread dongjianqiang2 at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #59 from John Dong  ---
(In reply to John Dong from comment #58)
> Created attachment 46022 [details]
> fix the union bug on 7.3.0

hi, I tried to fix the bug when expanding. is it OK?

[Bug tree-optimization/88739] [7 Regression] Big-endian union bug

2019-03-26 Thread dongjianqiang2 at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88739

--- Comment #58 from John Dong  ---
Created attachment 46022
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46022&action=edit
fix the union bug on 7.3.0