[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

2023-09-13 Thread ndesaulniers at google dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512

Nick Desaulniers  changed:

   What|Removed |Added

 CC||ndesaulniers at google dot com

--- Comment #10 from Nick Desaulniers  ---
I'm not super happy that GCC has false-negatives when %p is encountered.  Bugs
do exist outside of the Linux kernel with the usage of %p that could be
flagged.

Clang-18 has recently added -Wno-format-overflow-non-kprintf and
-Wformat-truncation-non-kprintf to emulate this behavior in
https://github.com/llvm/llvm-project/pull/65969, which we will use in the
kernel
https://github.com/ClangBuiltLinux/linux/issues/1923#issuecomment-1718144462.

At the least, I think this behavior wrt. %p should either be documented, or
-Wno-format-overflow-non-kprintf and -Wformat-truncation-non-kprintf
implemented in GCC.

That said, this diagnostic catches real bugs!  Linus turned them off, but we
will work through fixing the instances identified towards the goal of getting
them re-enabled for the Linux kernel.
https://github.com/KSPP/linux/issues/343

[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

2017-10-16 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512

--- Comment #9 from Paul Thomas  ---
Author: pault
Date: Mon Oct 16 19:44:04 2017
New Revision: 253794

URL: https://gcc.gnu.org/viewcvs?rev=253794=gcc=rev
Log:
2017-10-16  Paul Thomas  

PR fortran/52832
* match.c (gfc_match_associate): Before failing the association
try again, allowing a proc pointer selector.

PR fortran/80120
PR fortran/81903
PR fortran/82121
* primary.c (gfc_match_varspec): Introduce 'tgt_expr', which
points to the associate selector, if any. Go through selector
references, after resolution for variables, to catch any full
or section array references. If a class associate name does
not have the same declared type as the selector, resolve the
selector and copy the declared type to the associate name.
Before throwing a no implicit type error, resolve all allowed
selector expressions, and copy the resulting typespec.

PR fortran/67543
* resolve.c (resolve_assoc_var): Selector must cannot be the
NULL expression and it must have a type.

PR fortran/78152
* resolve.c (resolve_symbol): Allow associate names to be
coarrays.

2017-10-16  Paul Thomas  

PR fortran/78512
* gfortran.dg/associate_9.f03 : Remove XFAIL.
* gfortran.dg/associate_26.f90 : New test.

PR fortran/80120
* gfortran.dg/associate_27.f90 : New test.

PR fortran/81903
* gfortran.dg/associate_28.f90 : New test.

PR fortran/82121
* gfortran.dg/associate_29.f90 : New test.

PR fortran/67543
* gfortran.dg/associate_30.f90 : New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_26.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_27.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_28.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_29.f90
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_30.f90
Modified:
branches/gcc-7-branch/gcc/fortran/ChangeLog
branches/gcc-7-branch/gcc/fortran/match.c
branches/gcc-7-branch/gcc/fortran/primary.c
branches/gcc-7-branch/gcc/fortran/resolve.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/associate_9.f03

[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

2017-09-21 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512

--- Comment #8 from Paul Thomas  ---
Author: pault
Date: Thu Sep 21 18:40:21 2017
New Revision: 253077

URL: https://gcc.gnu.org/viewcvs?rev=253077=gcc=rev
Log:
2017-09-21  Paul Thomas  

PR fortran/52832
* match.c (gfc_match_associate): Before failing the association
try again, allowing a proc pointer selector.

PR fortran/80120
PR fortran/81903
PR fortran/82121
* primary.c (gfc_match_varspec): Introduce 'tgt_expr', which
points to the associate selector, if any. Go through selector
references, after resolution for variables, to catch any full
or section array references. If a class associate name does
not have the same declared type as the selector, resolve the
selector and copy the declared type to the associate name.
Before throwing a no implicit type error, resolve all allowed
selector expressions, and copy the resulting typespec.

PR fortran/67543
* resolve.c (resolve_assoc_var): Selector must cannot be the
NULL expression and it must have a type.

PR fortran/78152
* resolve.c (resolve_symbol): Allow associate names to be
coarrays.

2017-09-21  Paul Thomas  

PR fortran/78512
* gfortran.dg/associate_26.f90 : New test.

PR fortran/80120
* gfortran.dg/associate_27.f90 : New test.

PR fortran/81903
* gfortran.dg/associate_28.f90 : New test.

PR fortran/82121
* gfortran.dg/associate_29.f90 : New test.

PR fortran/67543
* gfortran.dg/associate_30.f90 : New test.

PR fortran/52832
* gfortran.dg/associate_31.f90 : New test.

Added:
trunk/gcc/testsuite/gfortran.dg/associate_26.f90
trunk/gcc/testsuite/gfortran.dg/associate_27.f90
trunk/gcc/testsuite/gfortran.dg/associate_28.f90
trunk/gcc/testsuite/gfortran.dg/associate_29.f90
trunk/gcc/testsuite/gfortran.dg/associate_30.f90
trunk/gcc/testsuite/gfortran.dg/associate_31.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/match.c
trunk/gcc/fortran/primary.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

2016-11-29 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
Patch along with a rationale for it posted for review:
https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02833.html

%p handling removed in r242975.

[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

2016-11-29 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78512

--- Comment #6 from Martin Sebor  ---
Author: msebor
Date: Tue Nov 29 21:08:02 2016
New Revision: 242975

URL: https://gcc.gnu.org/viewcvs?rev=242975=gcc=rev
Log:
PR tree-optimization/78512 - [7 Regression] r242674 miscompiles Linux kernel

gcc/ChangeLog:

PR tree-optimization/78512
* config/linux.h (TARGET_PRINTF_POINTER_FORMAT): Remove.
* config/rs6000/linux.h: Same.
* config/rs6000/linux64.h: Same.
* config/sol2.h: Same.
* config/sol2.c (solaris_printf_pointer_format): Remove.
* doc/tm.texi.in (TARGET_PRINTF_POINTER_FORMAT): Remove.
* doc/tm.texi: Regenerate.
* gimple-ssa-sprintf.c (format_pointer): Rempove.
(pass_sprintf_length::compute_format_length): Return bool.
(pass_sprintf_length::handle_gimple_call): Adjust.
* target.def (printf_pointer_format): Remove.
* targhooks.c (default_printf_pointer_format): Remove.
(linux_printf_pointer_format): Same.
* targhooks.h (default_printf_pointer_format): Remove.
(linux_printf_pointer_format, solaris_printf_pointer_format): Same.

gcc/testsuite/ChangeLog:

PR tree-optimization/78512
* gcc.dg/tree-ssa/builtin-sprintf-6.c: Add test cases.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Remove test cases.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/linux.h
trunk/gcc/config/rs6000/linux.h
trunk/gcc/config/rs6000/linux64.h
trunk/gcc/config/sol2.c
trunk/gcc/config/sol2.h
trunk/gcc/doc/tm.texi
trunk/gcc/doc/tm.texi.in
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/target.def
trunk/gcc/targhooks.c
trunk/gcc/targhooks.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-6.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c

[Bug tree-optimization/78512] [7 Regression] r242674 miscompiles Linux kernel

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

--- Comment #5 from Jeffrey A. Law  ---
I wonder if we just need to bite the bullet and decide that %p is too system
dependent, particularly when performing optimization.