[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-12-14 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Thomas Preud'homme  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||5.4.1, 6.2.1
 Resolution|--- |FIXED
  Known to fail|5.4.1, 6.2.1|5.4.0, 6.2.0

--- Comment #11 from Thomas Preud'homme  ---
Fixed in all affected branches.

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-12-14 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #10 from Thomas Preud'homme  ---
Author: thopre01
Date: Wed Dec 14 10:07:01 2016
New Revision: 243637

URL: https://gcc.gnu.org/viewcvs?rev=243637=gcc=rev
Log:
Fix PR77673: bswap loads passed end of object

2016-12-14  Thomas Preud'homme  

Backport from mainline
2016-11-25  Thomas Preud'homme  

gcc/
PR tree-optimization/77673
* tree-ssa-math-opts.c (struct symbolic_number): Add new src field.
(init_symbolic_number): Initialize src field from src parameter.
(perform_symbolic_merge): Select most dominated statement as the
source statement.  Set src field of resulting n structure from the
input src with the lowest address.
(find_bswap_or_nop): Rename source_stmt into ins_stmt.
(bswap_replace): Rename src_stmt into ins_stmt.  Initially get source
of load from src field rather than insertion statement.  Cancel
optimization if statement analyzed is not dominated by the insertion
statement.
(pass_optimize_bswap::execute): Rename src_stmt to ins_stmt.  Compute
dominance information.

gcc/testsuite/
PR tree-optimization/77673
* gcc.dg/pr77673.c: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gcc.dg/pr77673.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/testsuite/ChangeLog
branches/gcc-5-branch/gcc/tree-ssa-math-opts.c

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-12-14 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #9 from Thomas Preud'homme  ---
Author: thopre01
Date: Wed Dec 14 09:58:23 2016
New Revision: 243635

URL: https://gcc.gnu.org/viewcvs?rev=243635=gcc=rev
Log:
Fix PR77673: bswap loads passed end of object

2016-12-14  Thomas Preud'homme  

Backport from mainline
2016-11-25  Thomas Preud'homme  

gcc/
PR tree-optimization/77673
* tree-ssa-math-opts.c (struct symbolic_number): Add new src field.
(init_symbolic_number): Initialize src field from src parameter.
(perform_symbolic_merge): Select most dominated statement as the
source statement.  Set src field of resulting n structure from the
input src with the lowest address.
(find_bswap_or_nop): Rename source_stmt into ins_stmt.
(bswap_replace): Rename src_stmt into ins_stmt.  Initially get source
of load from src field rather than insertion statement.  Cancel
optimization if statement analyzed is not dominated by the insertion
statement.
(pass_optimize_bswap::execute): Rename src_stmt to ins_stmt.  Compute
dominance information.

gcc/testsuite/
PR tree-optimization/77673
* gcc.dg/pr77673.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr77673.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-ssa-math-opts.c

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-25 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #8 from Thomas Preud'homme  ---
Author: thopre01
Date: Fri Nov 25 10:03:38 2016
New Revision: 242869

URL: https://gcc.gnu.org/viewcvs?rev=242869=gcc=rev
Log:
Fix PR77673: bswap loads passed end of object

2016-11-25  Thomas Preud'homme  

gcc/
PR tree-optimization/77673
* tree-ssa-math-opts.c (struct symbolic_number): Add new src field.
(init_symbolic_number): Initialize src field from src parameter.
(perform_symbolic_merge): Select most dominated statement as the
source statement.  Set src field of resulting n structure from the
input src with the lowest address.
(find_bswap_or_nop): Rename source_stmt into ins_stmt.
(bswap_replace): Rename src_stmt into ins_stmt.  Initially get source
of load from src field rather than insertion statement.  Cancel
optimization if statement analyzed is not dominated by the insertion
statement.
(pass_optimize_bswap::execute): Rename src_stmt to ins_stmt.  Compute
dominance information.

gcc/testsuite/
PR tree-optimization/77673
* gcc.dg/pr77673.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr77673.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-math-opts.c

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-23 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #7 from Thomas Preud'homme  ---
(In reply to Thomas Preud'homme from comment #6)
> (In reply to Thomas Preud'homme from comment #5)
> > Got a patch, testing it now.
> 
> Bootstrapped and testsuite came back clean. Trying to turn the code in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673#c0 into a testcase.
> Expect a patch soon.
> 
> Best regards.

Patch is open for review at
https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02337.html

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Richard Biener  changed:

   What|Removed |Added

   Priority|P1  |P2

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-22 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Thomas Preud'homme  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-22 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Thomas Preud'homme  changed:

   What|Removed |Added

   Priority|P1  |P3

--- Comment #6 from Thomas Preud'homme  ---
(In reply to Thomas Preud'homme from comment #5)
> Got a patch, testing it now.

Bootstrapped and testsuite came back clean. Trying to turn the code in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673#c0 into a testcase. Expect a
patch soon.

Best regards.

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-21 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Jeffrey A. Law  changed:

   What|Removed |Added

   Priority|P3  |P1
 CC||law at redhat dot com

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-17 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #5 from Thomas Preud'homme  ---
Got a patch, testing it now.

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-15 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Thomas Preud'homme  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Last reconfirmed|2016-09-21 00:00:00 |2016-11-15
   Assignee|unassigned at gcc dot gnu.org  |thopre01 at gcc dot 
gnu.org

--- Comment #4 from Thomas Preud'homme  ---
Confirmed.

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-11-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

--- Comment #3 from Jakub Jelinek  ---
Regressed with r211778 aka PR61517.

[Bug tree-optimization/77673] [5/6/7 Regression] 4-byte load generated instead of 1-byte load, possibly reading past the end of object

2016-09-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-21
  Component|middle-end  |tree-optimization
   Target Milestone|--- |5.5
Summary|4-byte load generated   |[5/6/7 Regression] 4-byte
   |instead of 1-byte load, |load generated instead of
   |possibly reading past the   |1-byte load, possibly
   |end of object   |reading past the end of
   ||object
 Ever confirmed|0   |1

--- Comment #2 from Andrew Pinski  ---
Confirmed.
The bswap pass is putting the word load and __builtin_bswap after the first
load instead right after the last load.