[Bug sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer

2021-04-23 Thread gcc-90 at tbilles dot hu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95693

--- Comment #13 from Tibor Billes  ---
Thank you all for fixing it!

[Bug sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer

2021-04-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95693

Jakub Jelinek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #12 from Jakub Jelinek  ---
Fixed.

[Bug sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer

2021-04-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95693

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

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

commit r8-10875-ga3458b238e1297ad7ab6f92ab1a00837f282691a
Author: Jakub Jelinek 
Date:   Fri Jan 22 19:03:23 2021 +0100

c++: Fix up ubsan false positives on references [PR95693]

Alex' 2 years old change to build_zero_init_1 to return NULL pointer with
reference type for references breaks the sanitizers, the assignment of NULL
to a reference typed member is then instrumented before it is overwritten
with a non-NULL address later on.
That change has been done to fix error recovery ICE during
process_init_constructor_record, where we:
  if (TYPE_REF_P (fldtype))
{
  if (complain & tf_error)
error ("member %qD is uninitialized reference", field);
  else
return PICFLAG_ERRONEOUS;
}
a few lines earlier, but then continue and ICE when build_zero_init returns
NULL.

The following patch reverts the build_zero_init_1 change and instead
creates
the NULL with reference type constants during the error recovery.

The pr84593.C testcase Alex' change was fixing still works as before.

2021-01-22  Jakub Jelinek  

PR sanitizer/95693
* init.c (build_zero_init_1): Revert the 2018-03-06 change to
return build_zero_cst for reference types.
* typeck2.c (process_init_constructor_record): Instead call
build_zero_cst here during error recovery instead of
build_zero_init.

* g++.dg/ubsan/pr95693.C: New test.

(cherry picked from commit e5750f847158e7f9bdab770fd9c5fff58c5074d3)

[Bug sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer

2021-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95693

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

https://gcc.gnu.org/g:4ccdb3fdbc14102c91b6148bcbe09d0763726ae0

commit r9-9408-g4ccdb3fdbc14102c91b6148bcbe09d0763726ae0
Author: Jakub Jelinek 
Date:   Fri Jan 22 19:03:23 2021 +0100

c++: Fix up ubsan false positives on references [PR95693]

Alex' 2 years old change to build_zero_init_1 to return NULL pointer with
reference type for references breaks the sanitizers, the assignment of NULL
to a reference typed member is then instrumented before it is overwritten
with a non-NULL address later on.
That change has been done to fix error recovery ICE during
process_init_constructor_record, where we:
  if (TYPE_REF_P (fldtype))
{
  if (complain & tf_error)
error ("member %qD is uninitialized reference", field);
  else
return PICFLAG_ERRONEOUS;
}
a few lines earlier, but then continue and ICE when build_zero_init returns
NULL.

The following patch reverts the build_zero_init_1 change and instead
creates
the NULL with reference type constants during the error recovery.

The pr84593.C testcase Alex' change was fixing still works as before.

2021-01-22  Jakub Jelinek  

PR sanitizer/95693
* init.c (build_zero_init_1): Revert the 2018-03-06 change to
return build_zero_cst for reference types.
* typeck2.c (process_init_constructor_record): Instead call
build_zero_cst here during error recovery instead of
build_zero_init.

* g++.dg/ubsan/pr95693.C: New test.

(cherry picked from commit e5750f847158e7f9bdab770fd9c5fff58c5074d3)

[Bug sanitizer/95693] [8/9 Regression] Incorrect error from undefined behavior sanitizer

2021-01-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95693

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[8/9/10 Regression] |[8/9 Regression] Incorrect
   |Incorrect error from|error from undefined
   |undefined behavior  |behavior sanitizer
   |sanitizer   |

--- Comment #9 from Jakub Jelinek  ---
Fixed for 10.3+ too.