[Bug c/96108] New: Different behavior in DSE pass

2020-07-08 Thread 499537630 at qq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96108

Bug ID: 96108
   Summary: Different behavior in DSE pass
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 499537630 at qq dot com
  Target Milestone: ---

There are different behavior in DSE pass between gcc10 and gcc7.3. BUT I do not
known the correctness of dse_classify_store.

In gcc7.3, we could get DSE_STORE_DEAD when we get DSE_STORE_MABEY_PARTIAL_DEAD
with gcc10.


$ cat tauth.c 
struct aa;
static inline struct aa* get_aa(void) {
  struct aa* a;
  return a;
}
struct aa {
  int b;
};
void test()
{
  get_aa()->b &= 0xfff0;
}

$(7.3)aarch64_be-linux-gnu-gcc -S tauth.c -O2  -o - 
.arch armv8-a
.file   "tauth.c"
.text
.align  2
.p2align 3,,7
.global test
.type   test, %function
test:
.LFB1:
.cfi_startproc
ret
.cfi_endproc
.LFE1:
.size   test, .-test
.ident  "GCC: 7.3.0"
.section.note.GNU-stack,"",@progbits

$(10.1)aarch64_be-linux-gnu-gcc -S tauth.c -O2 -o -
.arch armv8-a
.file   "tauth.c"
.text
.align  2
.p2align 4,,11
.global test
.type   test, %function
test:
.LFB1:
.cfi_startproc
mov x0, 0
ldr w1, [x0]
and w1, w1, 65520
str w1, [x0]
ret
.cfi_endproc
.LFE1:
.size   test, .-test
.ident  "GCC:  10.1.0"
.section.note.GNU-stack,"",@progbits

[Bug tree-optimization/96108] Different behavior in DSE pass

2020-07-08 Thread 499537630 at qq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96108

--- Comment #2 from Jolyon <499537630 at qq dot com> ---
(In reply to Andrew Pinski from comment #1)
> Did it only change when a is uninitialized or was this a reduction of a
> bigger code and you reduced it too far?

Or you could fix the tauth.c???
$cat tauth.c
struct aa;
static inline struct aa* get_aa(void) {
  struct aa* a;
  return a;
}
struct aa {
  int b;
};
int main()
{
  get_aa()->b &= 0xfff0;
  return 0;
}

[Bug tree-optimization/96108] Different behavior in DSE pass

2020-07-08 Thread 499537630 at qq dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96108

--- Comment #6 from Jolyon <499537630 at qq dot com> ---
I agree that we really can't do this in the test. GCC's inconsistencies with
this behavior are beyond the developers' consideration(the behavior of DSE
pass). I tried to initialize the structure and the results were the same. MAYBE
it should not be a compiler optimization problem.