[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 Andrew Pinski changed: What|Removed |Added Assignee|pinskia at gcc dot gnu.org |unassigned at gcc dot gnu.org

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #8 from Andrew Pinski --- Created attachment 51253 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51253&action=edit Better patch here is the better patch which also handles the alignment check :).

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #7 from Andrew Pinski --- (In reply to Jakub Jelinek from comment #6) > UBSAN_NULL doesn't check just whether it is non-NULL, but also the alignment. > So no, this doesn't look like the right fix. Ok, I will add the check for align

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #6 from Jakub Jelinek --- UBSAN_NULL doesn't check just whether it is non-NULL, but also the alignment. So no, this doesn't look like the right fix.

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #5 from Andrew Pinski --- This is the fix which works: diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ad7b140173f..f1fbdbd40c2 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5587,6 +5587,16 @@ gimple_fold_call (

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #4 from Andrew Pinski --- (In reply to Andrew Pinski from comment #3) > + && DECL_WEAK (TREE_OPERAND (t, 0))) typo, should have been !DECL_WEAK :).

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 Andrew Pinski changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 --- Comment #2 from Andrew Pinski --- You can see the difference here: float b(unsigned a) { return *(float*)&a; } float d1(unsigned a) { unsigned t = a; return *(float*)&t; }

[Bug tree-optimization/101758] Inconsistent optimizations with UBSan

2021-08-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101758 Andrew Pinski changed: What|Removed |Added Ever confirmed|0 |1 Component|sanitizer