[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2022-03-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

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

https://gcc.gnu.org/g:6a777ceb0e975f0efc823d2d82e676346f068151

commit r12-7920-g6a777ceb0e975f0efc823d2d82e676346f068151
Author: Jakub Jelinek 
Date:   Wed Mar 30 16:04:52 2022 +0200

testsuite: Change pr80334.C testcase to dg-do compile [PR102772]

The testcase has UB at runtime, placement new shouldn't construct
an object with certain alignment requirements into an unaligned buffer.

2022-03-30  Jakub Jelinek  

PR tree-optimization/80334
PR target/102772
* g++.dg/torture/pr80334.C: Change from dg-do run to dg-do compile.

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2018-08-21 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

--- Comment #14 from Alexandre Oliva  ---
Done, bug 87054.

The patch in comment 13 fails libstdc++-v3; the language-independent
get_object_alignment can't deal with unresolved template expressions, so using
the same logic you added to ivopts to adjust the type of the
compiler-introduced pointer won't do in build_fold_addr_expr_loc.

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2018-08-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

--- Comment #13 from Richard Biener  ---
(In reply to Alexandre Oliva from comment #12)
> Created attachment 44527 [details]
> candidate patch to fix the error noted in comment 11
> 
> This patch fixes the unaligned accesses in the testcase in comment 11.  I
> haven't yet tested it otherwise.

The patch doesn't make much sense.  Whoever is "consuming" the pointer
does the wrong thing.

Please open a new bug as well.

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2018-08-11 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

--- Comment #12 from Alexandre Oliva  ---
Created attachment 44527
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44527=edit
candidate patch to fix the error noted in comment 11

This patch fixes the unaligned accesses in the testcase in comment 11.  I
haven't yet tested it otherwise.

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2018-08-11 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

Alexandre Oliva  changed:

   What|Removed |Added

 CC||aoliva at gcc dot gnu.org

--- Comment #11 from Alexandre Oliva  ---
FWIW, this testcase still fails with unaligned accesses in the trunk:

#ifndef T
# define T long
#endif
#ifndef R
# define R "r"
#endif


typedef T A; // #define T to long or __int128
struct B { char d; A c; } __attribute__((packed));
B b[50]; // many elements to avoid loop unrolling

int main () {
  for (int i = 0; i < sizeof(b) / sizeof(*b); i++) {
asm ("" : "+" R (b[i].unpacked)); // #define R to "r" on ppc or "x" on
x86_64
  }
}

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2017-05-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

Richard Biener  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/80334] [5 Regression] Segfault when taking address of copy of unaligned struct

2017-05-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80334

--- Comment #9 from Richard Biener  ---
Author: rguenth
Date: Wed May 10 07:53:45 2017
New Revision: 247827

URL: https://gcc.gnu.org/viewcvs?rev=247827=gcc=rev
Log:
2017-05-10  Richard Biener  

Backport from mainline
2017-03-21  Richard Biener  

PR tree-optimization/80122
* tree-inline.c (copy_bb): Do not expans va-arg packs or
va_arg_pack_len when the inlined call stmt requires pack
expansion itself.
* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.

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

2017-03-28  Richard Biener  

PR middle-end/80222
* gimple-fold.c (gimple_fold_indirect_ref): Do not touch
TYPE_REF_CAN_ALIAS_ALL references.
* fold-const.c (fold_indirect_ref_1): Likewise.

* g++.dg/pr80222.C: New testcase.

2017-04-06  Richard Biener  

PR tree-optimization/80334
* tree-ssa-loop-ivopts.c (rewrite_use_address): Properly
preserve alignment of accesses.

* g++.dg/torture/pr80334.C: New testcase.

2017-04-27  Richard Biener  

PR middle-end/80539
* tree-chrec.c (chrec_fold_plus_poly_poly): Deal with not
being in loop-closed SSA form conservatively.
(chrec_fold_multiply_poly_poly): Likewise.

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

Added:
branches/gcc-5-branch/gcc/testsuite/g++.dg/pr80222.C
branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr80334.C
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr80122.c
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr80539.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/fold-const.c
branches/gcc-5-branch/gcc/gimple-fold.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog
branches/gcc-5-branch/gcc/tree-chrec.c
branches/gcc-5-branch/gcc/tree-inline.c
branches/gcc-5-branch/gcc/tree-inline.h
branches/gcc-5-branch/gcc/tree-ssa-loop-ivopts.c